$('#nav').flexigrid({ url: '/Person/Management/List', dataType: 'json', colModel: [ { display: 'Username', name: 'Username', width: 150, sortable: true, align: 'left' }, { display: 'Firstname', name: 'Firstname', width: 150, sortable: true, align: 'left' }, { display: 'Lastname', name: 'Lastname', width: 150, sortable: true, align: 'left' }, { display: 'Favorite#', name: 'FavoriteNumber', width: 150, sortable: true, align: 'left' } ], buttons: [ { name: 'Add', bclass: 'add', onpress: add }, { separator: true }, { name: 'Edit', bclass: 'edit', onpress: edit }, { separator: true }, { name: 'Delete', bclass: 'delete', onpress: del } ], singleSelect: true, sortname: 'Lastname', sortorder: 'asc', usepager: true, title: 'Persons', useRp: true, rp: 5, rpOptions: [5, 10, 15, 20, 25, 40], showTableToggleBtn: true, width: 560, height: 'auto', preProcess: function (data) { var rp = getFgRowsPerPage($('#nav')); for (i = data.rows.length; i < rp; ++i) { data.rows.push({ 'id': '', 'cell': ['', '', '', ''] }); } return data; } }); function getFgRowsPerPage(tbl) { return $('select[name=rp] option:selected', tbl.closest('.flexigrid')).val(); }
Sample output(the last two rows are from the for loop):
No comments:
Post a Comment