Forum


17:02

08/02/2013

Hi all guys!
I'm facing this bug with jqGrid 4.4.1 and JQuery 1.8.2 both in IE9 and FF:
I defined a jqgrid with loadonce:true and some columns with a few of them that are hidden:
{ name: 'error', index: 'error_val', width: 20, resizable: false, align: 'center', fixed: true },
{ name: 'error_val', index: 'error_val', width: 0, hidden: true},
The column "error" is visible and shows an icon if there's an error in that row and is referred for the sorting ('index') to "error_val"
The column "error_val" is hidden and contains value '0' if there isn't an error and '1' if an error occurs.
Programmatically I put values in the cells of both columns with a statement like:
$('#grid').jqGrid('getGridParam', 'data')[$('#grid').jqGrid('getGridParam', '_index')[record_id]].error = '<img src="error.png" />';
$('#grid').jqGrid('getGridParam', 'data')[$('#grid').jqGrid('getGridParam', '_index')[record_id]].error_val = '1';
... then I wanna sort the column 'error' or 'error_val' programmatically when a button fires with a statement like
$('#grid').sortGrid('error', true, 'desc').setGridParam({ page: 1 }).trigger('reloadGrid');
..., so the rows with the error icon will be seen as the first rows in the first page. Problem is: when I sort with this last statement the rows appear sorted for the column 'error' but it involves only the rows of the visible page, if I have error icons in rows in page 2 or 3 they'll not appears in the first page after the osrting as I expect.
Thanks,
Zwonimir
10:50

08/02/2013

a clue:
it works well if programmatically I pass through all pages:
var lastpage = $('#grid').getGridParam('lastpage');
if (lastpage == null || lastpage == undefined) {
lastpage = 1;
}
if (lastpage > 1) {
for (var idxPage = lastpage; idxPage>= 1; idxPage--) {
$('#grid').setGridParam({ page: idxPage }).trigger('reloadGrid');
}
$('#grid').sortGrid('error_val', true, 'desc').trigger('reloadGrid');
} else {
$('#grid').sortGrid('error_val', true, 'desc').setGridParam({ page: 1 }).trigger('reloadGrid');
}
Of course it's useless with a lot of pages, it takes too much time 🙂
Thx,
Zwonimir
10:17

08/02/2013

ah it doesn't work even if I apply a filter
postdata = $('#grid').jqGrid('getGridParam','postData');
$.extend(postdata, { filters:'', searchField: 'error_val', searchOper: 'eq', searchString: '1'});
$('#grid').jqGrid('setGridParam', { search: true, postData: postdata }).trigger("reloadGrid",[{ page: 1 }]);
it filter only the records of the pages I've visited.
Most Users Ever Online: 715
Currently Online:
60 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66