Forum


01:58

27/06/2012

Hi
Need some help please
I am using a multiselect jqgrid with onSelectRow, onSelectAll and gridComplete event. My issue is when i check selectall check box which is selecting all the rows in the grid view but as soon as the gridComplete is called selectall check box is getting unchecked and i am not able to unselect all the rows.
Please let me know if some thing i need to take care here. below is my code
$("#"+tableID).jqGrid({
datastr: wellboresData,
datatype:"jsonstring",
colNames:['id','Well Legal Name','Wellbore Legal Name', 'Region', 'Country','State','Kick-off Latitude','Kick-off Longitude','Bottom Hole Latitude','Bottom Hole Longitude'],
colModel:[
{name:'id', width:100,hidden: true, align:"left", key:true},
{name:'wellLegalName', width:"15%", align:"left"},
{name:'wellboreLegalName', width:"10%", align:"left"},
{name:'region', width:"15%", align:"left",sortable:true, jsonmap: "location.region"},
{name:'country', width:"15%", align:"left",sortable:true, jsonmap: "location.country"},
{name:'state', width:"10%", align:"left",sortable:true, jsonmap: "location.state"},
{name:'kolat', width:"10%", align:"right",sortable:true, sorttype:"float", jsonmap: "location.koCoord.latitude"},
{name:'kolong', width:"10%", align:"right",sortable:true, sorttype:"float", jsonmap: "location.koCoord.longitude"},
{name:'bhlat', width:"10%", align:"right",sortable:true, sorttype:"float", jsonmap: "location.bhCoord.latitude"},
{name:'bhlong', width:"10%", align:"right",sortable:true, sorttype:"float", jsonmap: "location.bhCoord.longitude"}
],
rowNum:20,
rowList:[5,10,20,50,100,200,500],
pager: '#'+pagerID,
sortname: 'id',
sortorder: "desc",
multiselect: true,
caption: "Wellbore List",
width:width,
height:"100%",
shrinkToFit:true,
jsonReader:{
repeatitems:false,
id:"Id",
root: function(wellboresData){return wellboresData;},
page: function(wellboresData){return 1;},
total: function(wellboresData){return 1;},
records: function(wellboresData){return wellboresData.length;}
},
onSelectRow: function(rowid,status){
if(status){
if (gridwellboreContext != null) {
if($.inArray(rowid,gridwellboreContext) === -1){
gridwellboreContext.push(rowid);
}
} else{
gridwellboreContext.push(rowid);
}
}else{
if($.inArray(rowid,gridwellboreContext) > -1){
gridwellboreContext.splice($.inArray(rowid,gridwellboreContext),1);
}
}
$("#"+tableID).data("modified", true);
},
onSelectAll: function(aRowids,status){
if(status){
for(var i=0; i<aRowids.length; i++){
if (gridwellboreContext != null) {
if($.inArray(aRowids[i],gridwellboreContext) === -1){
gridwellboreContext.push(aRowids[i]);
}
} else{
gridwellboreContext.push(aRowids[i]);
}
}
}else{
for(var i=0; i<aRowids.length; i++){
if($.inArray(aRowids[i],gridwellboreContext) > -1){
gridwellboreContext.splice($.inArray(aRowids[i],gridwellboreContext),1);
}
}
}
$("#"+tableID).data("modified", true);
},
gridComplete: function(){
if (gridwellboreContext != null) {
$.each(gridwellboreContext, function (e, wellboreId) {
$("#"+tableID).jqGrid('setSelection',wellboreId);
});
}
}
});
$("#"+tableID).jqGrid('navGrid','#'+pagerID,
{edit:false,add:false,del:false},
{},
{},
{},
{multipleSearch:true, multipleGroup:true}
);
Most Users Ever Online: 715
Currently Online:
45 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