Forum


21:51

11/04/2011

Not a new topic, but I just can't figure out how to make jqGrid get the alternate row backgrounds right after sorting. I am loading the grid fine with correct alternate rows using altRow:true and altclass:'myAltClass' however when I sort the class is wrong. If I remove the altRow and altclass and try to fiddle with values in loadComplete or gridComplete I get weird results. Any ideas would be very much appreciated. Cheers
Hello,
Please post what are all your grid options?
i.e $grid->setGridOptions(....)
Do you use datatype=local?
Also in the future please post your code, this will save our and your time.
Kind Regards
jQuery("#gwidth").jqGrid(
{
url:'ajaxtest.php?terri='+terri+'&ruler='+ruler,
datatype: "json",
colNames:['name','id', 'industry'],
colModel:[ {name:'id',index:'id', width:155},
{name:'name',index:'name', width:100},
{name:'industry',index:'industry', width:180,align:"left"}
],
height:howhi,
loadOnce:true,
sortname: 'id',
sortable: true,
rowNum:100000,
scrollOffset: 25,
autowidth:true,
shrinkToFit:false,
altRows:true,
altclass:"myAltRowClass",
//loadComplete : function () {
// jQuery("#gridid").jqGrid('setGridParam',{datatype:'local'});
//applyZebra('gwidth');
//},
onSortCol: function(index, iCol, sortorder) {
$("#gwidth").setGridParam({ datatype: 'local' });
//$("tr.#gwidth:odd").addClass('myAltRowClass');
// applyZebra('gwidth');
},
gridview: true,
gridComplete: function() {
// applyZebra('gwidth');
}
// forceFit : true
}
);
Hello,
It seems you use the open source version, but instead I will check it.
In your code you have
loadOnce:true,
this is bad - it should be:
loadonce : true
which mean you do not post your original code.
How look your myAltRowClass.
Please post your problem here:
http://www.trirand.com/blog
Kind Regards
Tony
Hello Tony, I sent the actual/origianl code. I also changed the loadOnce:true but it made no difference in what I was seeing.
Is there a way to do this so that the zebra stripes respect the fact that the grid has been sorted? thanks!
Most Users Ever Online: 715
Currently Online:
120 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