Forum


I am trying to use the altRows feature. However, it does not appear to work for me. The Javascript below works for everything but "altRows".
Any help appreciated.
Tom
$(document).ready(
function
() {
GridDemo.Home.GridDemo.setupGrid($(
"#grid"), $("#pager"), $("#search"
));
});
GridDemo.Home.GridDemo = {
setupGrid:
function
(grid, pager, search) {
grid.jqGrid({
colNames: [
'Int', 'String', 'Date'
],
colModel: [
{ name:
'IntProperty', index: 'IntProperty'
},
{ name:
'StringProperty', index: 'StringProperty'
},
{ name:
'DateProperty', index: 'DateProperty'
},
],
pager: pager,
sortname:
'IntProperty'
,
rowNum: 20,
rowList: [10, 20, 50],
sortorder:
"asc"
,
url:
"GetGridData"
,
altRows:
true
}).navGrid(pager, { edit:
false, add: false, del: false, search: false
});
search.filterGrid(
"#" + grid.attr("id"
), {
gridModel:
false
,
filterModel: [{
label:
'Search'
,
name:
'search'
,
stype:
'text'
}]
});
}
};
07:14

Moderators
08/10/2009

Can you please check out the version and the Theme you are using? Some of the ThemeRoller themes shipped do not support that (or it is very hardly visibile - for example the Redmond theme and the Start theme). You can check out with the UI Darkness for example.
Trirand ASP.NET WebForms & MVC components based on jQuery & ThemeRoller
01:37

20/10/2009

When you add an altRows:true to your options object, you get .ui-priority-secondary class on every next row, you can add a css rule yourself, at least that's how I do it.
But my problem is little different. altRows option works good at first, I get zebra grid, but it doesn't keeps it that way after sorting operation on any column. Rows get messed. Is there any established way to deal with this "issue"?
Still no luck. I have tried entering the code just as you say. I think I have done it. See code below which shows the css files and the code:
I have tried using single and double quotes around altRow in the javascript. I have tried Vader for the theme. I have tried Redmond. All three work but none of them show. I have tried putting the css for red background in the site.css file. While the jqGrid shows everything correct but the altRow coloring. So the problem must be in the CSS but I don't see it.
I have to say, while I love jQuery and especially jqGrid, troubleshooting the styling is hit and miss. I sure wish there was a say to troubleshoot CSS structure and see what has been pulled in.
<link href="../../Content/Site.css" rel="stylesheet" type="text/css" />
<link href="<%= Url.Content("~/Scripts/jqGrid/themes/smoothness/jquery-ui-1.7.2.custom.css") %>" rel="stylesheet" type="text/css" />
<!-- This css link must match the name (here: smoothness) used in the imgpath for the jqGrid -->
<link href="<%= Url.Content("~/Scripts/jqGrid/themes/smoothness/ui.all.css") %>" rel="stylesheet" type="text/css" />
<link href="<%= Url.Content("~/Scripts/jqGrid/themes/ui.jqGrid.css") %>" rel="stylesheet" type="text/css" />
<style type="text/css" >
.ui-jqgrid .altRow td{background-color: red;}
</style>
<div id="gridwrapper">
<div id="search"></div>
<table id="grid" class="scroll" cellpadding="0" cellspacing="0"></table>
<div id="pager" class="scroll" style="text-align:center;"></div>
</div>
$(document).ready(function() {
GridDemo.Home.GridDemo.setupGrid($("#grid"), $("#pager"), $("#search"));
});
GridDemo.Home.GridDemo = {
setupGrid: function(grid, pager, search) {
grid.jqGrid({
colNames: ['Int', 'String', 'Date'],
colModel: [
{ name: 'IntProperty', index: 'IntProperty' },
{ name: 'StringProperty', index: 'StringProperty' },
{ name: 'DateProperty', index: 'DateProperty' },
],
pager: pager,
sortname: 'IntProperty',
rowNum: 20,
rowList: [10, 20, 50],
sortorder: "asc",
url: "GetGridData",
altClass: 'altRow',
altRows: true,
gridComplete: handleGridComplete
}).navGrid(pager, { edit: false, add: false, del: false, search: false });
search.filterGrid("#" + grid.attr("id"), {
gridModel: false,
filterModel: [{
label: 'Search',
name: 'search',
stype: 'text'
}]
});
}
};
function handleGridComplete()
{
var recs = parseInt($("#grid").getGridParam("records"),10);
if (recs = 0)
{
$("gridwrapper").hide();
alert("No records returned!");
}
else
{
$("gridwrapper").hide();
//alert("Records returned.");
}
}
04:45

Moderators
30/10/2007

Hello,
There was a bug when we use datatype local (already fixed), but this is not your case. In some themes there is no diffrence with the alt rows, by example redmond. Try with other theme and see the result.
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.
I have tried "smoothness", "Redmond" (which you state will not show difference with "altRows" because of its CSS) and "Vader" - none which show a difference in the alternate rows. Does anyone know a theme in which the altRows option does show a difference?
Second, I also attempted to set the background color to red as suggested above. This also did not work.
Tom
07:52

If you tried another theme, make sure you left out the option altClass: 'altRow', because the jQuery Theming uses a default altClass, which is different from 'altRow' (something like ui-second-priority). Try the theme UI Darkness as Rumen said, because in smoothness and Redmond the alternating rows are not or hardly visible.
If you have Firefox web developer extension installed, check the generated source of your jqgrid by right clicking your page: Web Developer - View Source - View generated source. There you can see if the CSS classes are added to the alternating rows of your jqgrid, and also what the name of the class is.
08:22

Moderators
08/10/2009

Tom, I have created for you a altRows example here:
http://www.trirand.net/example.....fault.aspx
Please, take a look at it and experiment with all the Themes available (25 of them) in the "Themes" tab below the example. You will notice that some theme roller themes do not support altRows, some do, some have very hardly visible differences.
Also, run FireBug for FireFox and check out how our setup is different from yours. Another thing to watch for - which version are you using? Please, try the very last official release (I believe 3.5.3 if I am not mistaken, 3.6 is still in beta).
Hopefully we can work this out.
Rumen Stankov
Trirand ASP.NET WebForms & MVC components based on jQuery & ThemeRoller
Hospital_Ghost: was not able to Darkness to work at all so I am sure I have a folder reference wrong. i will try again.
Rumen: Okay. I will look at the example. Site is internal and use IE but I will try to download a copy of Firefox and Firebug and see if that helps with my debugging. Will probably not be able to get to it today so will be tomorrow at latest before I can reply.
But thanks for everyone hanging in with suggestions and support. I extremely impressed with jqGrid (and jQuery in general) and am determined to work my way through this.
Tom
10:44

Moderators
08/10/2009

Yes, I see. In IE it is really different than FireFox / Chrome / Safari. In this particular example:
http://www.trirand.net/example.....
and choosing UI Darkness from themes, the alternating background is clearly visible for the aforementioned browsers and hardly visible (I think only the foreground color is a bit different, but not background).
This seems like something we will need to look after and fix (but this could be manually fixed problably, by employing a technique suggested before in this thread, like manually changing the selectors for altRows).
We will look into this in detail and address that. Please, excuse us for the inconvenience.
Regards,
Rumen Stankov
Trirand ASP.NET WebForms & MVC components based on jQuery & ThemeRoller
Thanks for the info and the help. I will monitor the forum for an update. My version of IE is IE8.
The link you provided is not working. Get the following web page:
Looking forward to eventually seeing the alternating rows. For now, I will continue my development and hold off on that feature until I know it should be workin.
Thanks again.
Tom
Error Summary
HTTP Error 404.0 - Not FoundThe resource you are looking for has been removed, had its name changed, or is temporarily unavailable.
Most Users Ever Online: 715
Currently Online:
43 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