Forum
04:37
There is a bug in the sorting a multiselect table with deselectAfterSort = true. The selections are reset. This happens because in grid.base.js at row 744 in the sortArrayData method it cancels all the selections that had been preserved in sortData. These are the "incriminated" rows.
if(ts.p.multiselect) {
$("tbody tr", ts.grid.bDiv).removeClass("ui-state-highlight");
$("[id^=jqg_]",ts.rows).attr("checked",false);
$("#cb_jqg",ts.grid.hDiv).attr("checked",false);
ts.p.selarrrow = [];
}
05:10
Moderators
30/10/2007
Hello Max,
Thanks. Actually this code is not needed. All is done in sortData function.
Fixed in GitHub
Betst Regards
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
04:45
Moderators
30/10/2007
Hello,
Check the jqGrid options and deselectAfterSort feature.
http://www.trirand.com/jqgridw.....ki:options
Regards
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
00:19
19/10/2010
This still isn't working.
Here's my table config:
datatype: 'local',
caption: 'All Vehicles',
colNames: ['DeviceId', 'Driver'],
colModel: [
{name: 'deviceId', firstsortorder: 'asc', sorttype: 'text', key: true},
{name: 'driver', sorttype: 'text'},
],
ignoreCase: true,
rowNum: 0,
viewrecords: true,
shrinkToFit: false,
sortable: true,
multiselect: true,
deselectAfterSort: false
});
When I sort, jqGrid('getGridParam', 'selarrrow') still returns the selected IDs, but the rows are not checked anymore. I've spent some time trying to debug the code, it looks like the selectionPreserver function is never getting called. Am I doing something wrong?
datatype: 'local',
caption: 'All Vehicles',
colNames: ['DeviceId', 'Driver'],
colModel: [
{name: 'deviceId', firstsortorder: 'asc', sorttype: 'text', key: true},
{name: 'driver', sorttype: 'text'},
],
ignoreCase: true,
rowNum: 0,
viewrecords: true,
shrinkToFit: false,
sortable: true,
multiselect: true,
deselectAfterSort: false,
onSelectRow: function(id, selected){
var selectedVehicle = core.getDataObject('Vehicle', id);
if(selected) {
var rowColor = rowColors.pop();
if(rowColor) {
$j(this).find('#' + id).css('backgroundColor', rowColor);
selectedVehicle.setRowColor(rowColor);
} else
alert('You may select a maximum of ' + MAX_SELECTED_VEHICLES + ' vehicles at a time.');
} else {
rowColors.push($j(this).find('#' + id).css('backgroundColor'));
$j(this).find('#' + id).css('backgroundColor', '');
selectedVehicle.clearRowColor();
if($j(this).jqGrid('getGridParam', 'selarrrow').length == 0)
$j(core).trigger(core.events.VEHICLE_LIST_SELECTION_CLEARED, {deviceId: id});
}
var selectedIds = $j(this).jqGrid('getGridParam', 'selarrrow');
var allSelectedVehicles = [];
for(var i = 0; i < selectedIds.length; i++) {
allSelectedVehicles.push(core.getDataObject('Vehicle', selectedIds[i]));
}
$j(core).trigger(core.events.VEHICLE_LIST_SELECTION_CHANGED,
{
vehicle: selectedVehicle,
selectedVehicles: allSelectedVehicles,
deselectEvent: !selected
}
);
},
beforeSelectRow: function(id, event){
if(event.target && $j(event.target).is(':checked')){
if(rowColors.length == 0) {
$j(event.target).attr('checked', false);
$j('<div align="center">You may select a maximum of ' + MAX_SELECTED_VEHICLES + ' vehicles at a time.</div>').dialog({
draggable: false,
resizable: false,
modal: true,
title: 'Error!',
width: 250,
buttons: {
'OK': function(){$j(this).dialog('destroy');}
},
close: function(){$j(this).dialog('destroy')}
});
return false;
}
}
return true;
}
});
18:09
04/09/2011
I am having the same issue. I did find a ticket in github https://github.com/tonytomov/jqGrid/issues/117
19:37
Moderators
30/10/2007
Hello,
The problem is fixed from long time.
Regards
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
Most Users Ever Online: 715
Currently Online:
34 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