Tips, Tricks and Hacks

Anthony Aragues at SuddenDevelopment.com shares these patterns.

To replace grid values:

,loadComplete: function(){ var ids = jQuery("#grid").getDataIDs(); /* for each row loaded *// for(var i=0;i<ids.length;i++){ var cl = ids[i]; /* get the row data, this works best when you have to do this for multiple columns, otherwise you might use getCell *// var objRowData = jQuery("#grid").getRowData(cl); /* for each column, give it a replacement or function that modifies the value *// jQuery("#grid").setRowData(cl,{ ntlm:renderCheckmark(objRowData.ntlmHidden) }); } }

To allow resorting of rows:

,loadComplete: function() { jQuery("#grid").tableDnD({ onDrop:function(objTable,objRow) { /* get the resulting order *// var rows = jQuery(‘#grid’).getDataIDs(); } } }

To add something in the middle of the navbar where the inserted position is relative to the "eq(1)"

jQuery(‘#gridPager td.nav-button:eq(1)’).after(‘html stuff to add in’);

To use the nav bar for buttons but hide the pager, using CSS

#grid #first, #grid #prev, #grid input.selbox, #grid #sp_1, #grid #sp_2, #grid #next, #grid #last{display:none;}


  Last Updated: 2/23/2009 | © Tony's jqGrid - a jQuery Plugin, 2010