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
sp_Feed Topic RSS sp_Related Related Topics sp_TopicIcon
non-unique ids ('first','prev','next','last','sp_1' and 'jqgh_'+colname) used in the pager
21/03/2011
13:20
Avatar
OlegK
Germany
Member
Members
Forum Posts: 1255
Member Since:
10/08/2009
sp_UserOfflineSmall Offline

Hello Tony,

Currently jqGrid use in the pager the same names 'first','prev','next','last','sp_1' and 'jqgh_'+colname for the ids. It can follow to id duplicates. Fo fix the problem I suggest to change lines 1525, 1545-1546, 1548-1549, 1552-1553, 1555-1556, 1733,1735, 1792-1795, 2037 and 3000 to the following:

… // 1525:

$('#sp_1_'+$.jgrid.jqID(ts.p.id),pgboxes).html($.fmatter ? $.fmatter.util.NumberFormat(ts.p.lastpage,fmt):ts.p.lastpage);

… // 1545-1546

$("#first_"+$.jgrid.jqID(ts.p.id)+", #prev_"+$.jgrid.jqID(ts.p.id),ts.p.pager).addClass('ui-state-disabled').removeClass('ui-state-hover');
if(ts.p.toppager) { $("#first_t_"+$.jgrid.jqID(ts.p.id)+", #prev_t_"+$.jgrid.jqID(ts.p.id),ts.p.toppager).addClass('ui-state-disabled').removeClass('ui-state-hover'); }

… // 1548-1549

$("#first_"+$.jgrid.jqID(ts.p.id)+", #prev_"+$.jgrid.jqID(ts.p.id),ts.p.pager).removeClass('ui-state-disabled');
if(ts.p.toppager) { $("#first_t_"+$.jgrid.jqID(ts.p.id)+", #prev_t_"+$.jgrid.jqID(ts.p.id),ts.p.toppager).removeClass('ui-state-disabled'); }

… // 1552-1553:

$("#next_"+$.jgrid.jqID(ts.p.id)+", #last_"+$.jgrid.jqID(ts.p.id),ts.p.pager).addClass('ui-state-disabled').removeClass('ui-state-hover');
if(ts.p.toppager) { $("#next_t_"+$.jgrid.jqID(ts.p.id)+", #last_t_"+$.jgrid.jqID(ts.p.id),ts.p.toppager).addClass('ui-state-disabled').removeClass('ui-state-hover'); }

… // 1555-1556:

$("#next_"+$.jgrid.jqID(ts.p.id)+", #last_"+$.jgrid.jqID(ts.p.id),ts.p.pager).removeClass('ui-state-disabled');
if(ts.p.toppager) { $("#next_t_"+$.jgrid.jqID(ts.p.id)+", #last_t_"+$.jgrid.jqID(ts.p.id),ts.p.toppager).removeClass('ui-state-disabled'); }

… // 1733:

if(ts.p.pginput===true) { pginp= "<td dir='"+dir+"'>"+$.jgrid.format(ts.p.pgtext || "","<input class='ui-pg-input' type='text' size='2' maxlength='7' value='0' role='textbox'/>","<span id='sp_1_"+$.jgrid.jqID(ts.p.id)+"'></span>")+"</td>";}

… // 1735:

var po=["first"+tp+"_"+$.jgrid.jqID(ts.p.id),"prev"+tp+"_"+$.jgrid.jqID(ts.p.id), "next"+tp+"_"+$.jgrid.jqID(ts.p.id),"last"+tp+"_"+$.jgrid.jqID(ts.p.id)]; if(dir=="rtl") { po.reverse(); }

… // 1782:

$("#first"+tp+"_"+$.jgrid.jqID(ts.p.id)+", #prev"+tp+"_"+$.jgrid.jqID(ts.p.id)+", #next"+tp+"_"+$.jgrid.jqID(ts.p.id)+", #last"+tp+"_"+$.jgrid.jqID(ts.p.id),"#"+pgid).click( function(e) {

… // 1792-1795:

if( this.id === 'first'+tp+"_"+$.jgrid.jqID(ts.p.id) && fp ) { ts.p.page=1; selclick=true;}
if( this.id === 'prev'+tp+"_"+$.jgrid.jqID(ts.p.id) && pp) { ts.p.page=(cp-1); selclick=true;}
if( this.id === 'next'+tp+"_"+$.jgrid.jqID(ts.p.id) && np) { ts.p.page=(cp+1); selclick=true;}
if( this.id === 'last'+tp+"_"+$.jgrid.jqID(ts.p.id) && lp) { ts.p.page=last; selclick=true;}

… // 2037:

thead += "<div id='jqgh_"+$.jgrid.jqID(ts.p.id)+"_"+ts.p.colModel[i].name+"' "+tdc+">"+ts.p.colNames[i];

… // 3000:

$("[id^=jqgh_"+$.jgrid.jqID(ts.p.id)+"]",thecol).empty().html(nData).append(ico);

Additionally I suggest to remove from the lines 2031 and 2032 the sort="desc" and sort="asc" from the definition of the <span> elements because the attributes not be used and they are not correct HTML/XHTML attributes. Only classes "ui-icon-asc", "ui-icon-desc" and "ui-grid-ico-sort" are used.

And the last suggestion. I try verify the code dinamally generated by jqGrid in the w3 validator and found out the small problem. So I suggest to modify the line 2161 to the following

var hTable = $("<table class='ui-jqgrid-htable' style='width:"+ts.p.tblwidth+"px' role='grid' aria-labelledby='gbox_"+this.id+"' cellspacing='0' cellpadding='0' border='0'><tbody><tr><td></td></tr><tbody></table>").append(thead),

The problem is that <table> element should has non-empty <tbody>. The <tbody><tr><td></td></tr><tbody> construct makes the table w3 complined (see here for details).

Best regards
Oleg

27/04/2011
20:06
Avatar
OlegK
Germany
Member
Members
Forum Posts: 1255
Member Since:
10/08/2009
sp_UserOfflineSmall Offline

Hello Tony!

You made currently some changes to fix the problem, but some small parts of code inside of updatepager still contain errors.

To clear the situation. If one use toppager:true parameter the controls of the pager will have the following ids:

sp_1_list_toppagerlast_t_list_toppagernext_t_list_toppagerprev_t_list_toppagerfirst_t_list_toppager

To use it I suggest to make the following modification in the updatepager code:

1) Insert additional line which define new tspg_t variable:

updatepager = function(rn, dnd) {
    var cp, last, base, from,to,tot,fmt, pgboxes = "", sppg,
    tspg = ts.p.pager ? "_"+$.jgrid.jqID(ts.p.pager.substr(1)) : "",
    tspg_t = ts.p.toppager ? "_"+ts.p.toppager.substr(1) : ""

Here I use the fact, that at the time of calling of updatepager function the line 2346

ts.p.toppager = $.jgrid.jqID(ts.p.id)+"_toppager";

are already executed and the ts.p.toppager contain normalized string like list_toppager.

2) The line 1532

sppg = ts.p.toppager ? '#sp_1'+tspg+",#sp_1"+tspg+"_toppager" : '#sp_1'+tspg;

should be fixed as

sppg = ts.p.toppager ? '#sp_1'+tspg+",#sp_1"+tspg_t : '#sp_1'+tspg;

3) The lines 1554, 1557, 1561 and 1564 must be fixed to use tspg_t instead of tspg:

if(cp==1 || cp === 0) {
    $("#first"+tspg+", #prev"+tspg).addClass('ui-state-disabled').removeClass('ui-state-hover');
    if(ts.p.toppager) { $("#first_t"+tspg_t+", #prev_t"+tspg_t).addClass('ui-state-disabled').removeClass('ui-state-hover'); }
} else {
    $("#first"+tspg+", #prev"+tspg).removeClass('ui-state-disabled');
    if(ts.p.toppager) { $("#first_t"+tspg_t+", #prev_t"+tspg_t).removeClass('ui-state-disabled'); }
}
if(cp==last || cp === 0) {
    $("#next"+tspg+", #last"+tspg).addClass('ui-state-disabled').removeClass('ui-state-hover');
    if(ts.p.toppager) { $("#next_t"+tspg_t+", #last_t"+tspg_t).addClass('ui-state-disabled').removeClass('ui-state-hover'); }
} else {
    $("#next"+tspg+", #last"+tspg).removeClass('ui-state-disabled');
    if(ts.p.toppager) { $("#next_t"+tspg_t+", #last_t"+tspg_t).removeClass('ui-state-disabled'); }

Best regards
Oleg

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