Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
This topic is locked No permission to create posts
sp_Feed Topic RSS sp_TopicIcon
altRows not working
19/10/2009
05:57
Avatar
tgueth
Member
Members
Forum Posts: 10
Member Since:
25/09/2009
sp_UserOfflineSmall Offline

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'

}]

});

}

};

19/10/2009
07:14
Avatar
Rumen[Trirand]
Moderator
Members

Moderators
Forum Posts: 81
Member Since:
08/10/2009
sp_UserOfflineSmall Offline

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

http://www.trirand.net

19/10/2009
07:16
Avatar
HoSpiTaL_gHoSt
Guest
Guests

This might be due to the theme you're using. Try adding altClass: 'altRow' and then add something like this to your css file:

.ui-jqgrid .altRow td{background-color: red;}

If this does work, then the problem was theming.

19/10/2009
18:26
Avatar
tgueth
Member
Members
Forum Posts: 10
Member Since:
25/09/2009
sp_UserOfflineSmall Offline

Theme is smoothness.

Table id is "grid".  When I added the style information below, nothing changed.  Here is the style information I entered:

<



style type="text/css" >

#grid .ui-jqgrid .altRow td{background-color: red;}

</



style>

Tom

20/10/2009
01:37
Avatar
jayarjo
Member
Members
Forum Posts: 17
Member Since:
20/10/2009
sp_UserOfflineSmall Offline

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"?

20/10/2009
02:52
Avatar
HoSpiTaL_gHoSt
Guest
Guests

tgueth,

You don't only have to add the CSS I gave you, but in your grid config you have to add this as well:

altClass: 'altRow',

altRows: true

20/10/2009
05:47
Avatar
tgueth
Member
Members
Forum Posts: 10
Member Since:
25/09/2009
sp_UserOfflineSmall Offline

Still does not work after adding the altClass:

altClass: 'altRow'

altRows: true

are both in the javascript setup.

20/10/2009
06:35
Avatar
HoSpiTaL_gHoSt
Guest
Guests

Mess around with the CSS. Very small differences to the CSS can suddenly make it work. Try the exact CSS I gave you, it worked for me in combination with altClass: 'altRow'.

20/10/2009
15:55
Avatar
tgueth
Member
Members
Forum Posts: 10
Member Since:
25/09/2009
sp_UserOfflineSmall Offline

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.");
    }
   
}

21/10/2009
04:45
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

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.

21/10/2009
05:26
Avatar
tgueth
Member
Members
Forum Posts: 10
Member Since:
25/09/2009
sp_UserOfflineSmall Offline

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

21/10/2009
07:52
Avatar
HoSpiTaL_gHoSt
Guest
Guests

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.

21/10/2009
08:22
Avatar
Rumen[Trirand]
Moderator
Members

Moderators
Forum Posts: 81
Member Since:
08/10/2009
sp_UserOfflineSmall Offline

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

http://www.trirand.net

21/10/2009
09:20
Avatar
tgueth
Member
Members
Forum Posts: 10
Member Since:
25/09/2009
sp_UserOfflineSmall Offline

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

21/10/2009
09:25
Avatar
tgueth
Member
Members
Forum Posts: 10
Member Since:
25/09/2009
sp_UserOfflineSmall Offline

Is there some reason that IE does not show different background for alternating rows?  Is this an IE bug?

When I run the trirand test page, I do not see alternating colors.

Tom

21/10/2009
10:44
Avatar
Rumen[Trirand]
Moderator
Members

Moderators
Forum Posts: 81
Member Since:
08/10/2009
sp_UserOfflineSmall Offline

Yes, I see. In IE it is really different than FireFox / Chrome / Safari. In this particular example:

http://www.trirand.net/example.....&nbsp;

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

http://www.trirand.net

21/10/2009
15:20
Avatar
tgueth
Member
Members
Forum Posts: 10
Member Since:
25/09/2009
sp_UserOfflineSmall Offline

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.

Detailed Error Information
Module IIS Web Core
Notification MapRequestHandler
Handler StaticFile
Error Code 0x80070002
Requested URL http://www.trirand.net:80/exam.....&nbsp
Physical Path E:\web\trirandnet0\htdocs\examples\appearance\alternate_row_background\default.aspx&nbsp
Logon Method Anonymous
Logon User Anonymous
Most likely causes:
  • The directory or file specified does not exist on the Web server.
  • The URL contains a typographical error.
  • A custom filter or module, such as URLScan, restricts access to the file.
Things you can try:
  • Create the content on the Web server.
  • Review the browser URL.
  • Create a tracing rule to track failed requests for this HTTP status code and see which module is calling SetStatus. For more information about creating a tracing rule for failed requests, click here.
Links and More Information

This error means that the file or directory does not exist on the server. Create the file or directory and try the request again.

View more information »

21/10/2009
15:22
Avatar
tgueth
Member
Members
Forum Posts: 10
Member Since:
25/09/2009
sp_UserOfflineSmall Offline

Never mind about the error with the link.  The &nbsp was causing the problem.  Did manual edit.  looking now.

Tom

21/10/2009
15:24
Avatar
tgueth
Member
Members
Forum Posts: 10
Member Since:
25/09/2009
sp_UserOfflineSmall Offline

Okay, got the web page.  But UI Darkness theme is not showing any differences in the rows either.  Putting this aside until someone has a sample where altRows shows a difference.  At least I don't feel so dumb now.

Tom

09/12/2009
11:19
Avatar
sirshurf
Member
Members
Forum Posts: 43
Member Since:
06/10/2009
sp_UserOfflineSmall Offline

Is there news about that?

It looks like I have the same problem...

This topic is locked No permission to create posts
Forum Timezone: Europe/Sofia

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.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information