Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function tableGridRender( columns, data ) {
- var rowIndex, columnIndex, table = jQuery( table || '<table><thead></thead><tbody><tbody></table>' ),
- row, coluntName, thead = '', tbody = '';
- for ( columnIndex = 0; columnIndex < columns.lenght; columnIndex++ ) {
- thead += '<th>' + columns[columnIndex] + '</th>\n';
- }
- thead = '<tr> ' + thead + '</tr>';
- for ( rowIndex = 0; rowIndex < data.length; rowIndex++ ) {
- row = '';
- for ( columnIndex = 0; columnIndex < columns.lenght; columnIndex++ ) {
- columnName = columns[columnIndex];
- if ( !data[rowIndex][columnName] )
- row += '<td>' + tableGridRender.EMPTY_CELL_VALUE + '</td>\n';
- else
- row += '<td>' + data[rowIndex][columnName] + '</td>\n';
- }
- tbody += '<tr>' + row + '</tr>';
- }
- jQuery( thead ).appendTo( table.find('thead') );
- jQuery( tbody ).appendTo( table.find('tbody') );
- return table;
- };
- tableGrid.EMPTY_CELL_VALUE = '<span class="xero_table_nothing">-</span>';
- tableGridRender([
- 'AccountID', // Xero identifier
- 'Code', // Customer defined account code eg. 200
- 'Name', // Name of account
- 'Status', // See Account Status Codes
- 'Type', // See Account Types
- 'TaxType', // See Tax Types
- 'Description', // Description of Account. All accounts except bank accounts return this element
- 'Class', // See Account Class Types
- 'SystemAccount', // If this is a system account then this element is returned. See System Account types
- 'EnablePaymentsToAccount', // Boolean – describes whether account can have payments applied to it
- 'ShowInExpenseClaims', // Boolean – describes whether account code is available for use with expense claims
- 'BankAccountNumber', // Shown for bank accounts only
- 'CurrencyCode', // Shown for bank accounts only
- // 'ReportingCode', // shown if set (NZ Orgs only)
- // 'ReportingCodeName' // shown if set (NZ Orgs only)
- ],
- [{ 'AccountID': '245', 'Code': '3534', 'Status': 'jdgnjsd' },
- { 'AccountID': '245', 'Code': '3534', 'Status': 'jdgnjsd' }])
- .appendTo(jQuery('#xero_contact_in_wrap'));
Advertisement
Add Comment
Please, Sign In to add comment