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_TopicIcon
some small bugs with double defining of the same variable
01/09/2009
11:03
Avatar
OlegK
Germany
Member
Members
Forum Posts: 1255
Member Since:
10/08/2009
sp_UserOfflineSmall Offline

Hello Tony!

Visual Suidio found some small bugs, which are not very importent, but they sould be better fixed. Most of all are the problem with double defining of the same variable in the same context:

————————————————————————————————————-

File: grid.base.js, function setRowData. The lines from 1528 till 1530 look like following

      var t = this, vl, ind;

      if(!t.grid) {return false;}

      var ind = t.rows.namedItem(rowid);

They should be fixed to

      var t = this, vl, ind;

      if(!t.grid) {return false;}

      var ind = t.rows.namedItem(rowid);

—————————————————————————————————————–

File: grid.base.js, function setGridWidth. In the line number 1734 it is defines variable cl:

      var cl = $t.grid.cols.length >0;

 but in the same scope in the lines 1692-1694:

var $t = this, cw,

initwidth = 0, brd=$t.p.cellLayout, lvc, vc=0, isSafari,hs=false, scw=$t.p.scrollOffset, aw, gw=0, tw=0,

msw = $t.p.multiselectWidth, sgw=$t.p.subGridWidth, rnw=$t.p.rownumWidth, cl = $t.p.cellLayout,cr;

So line number 1734 should be probably fixed like

      var cl = $t.grid.cols.length >0;

—————————————————————————————————————–

File: grid.common.js, function checkValues.  In the line number 347 it is defined variable edtrul:

var edtrul = g.p.colModel[valref].editrules;

But in the same scope in the line number 336 already defined

var edtrul,i, nm;

So the line number 347 should be fixed as

var edtrul = g.p.colModel[valref].editrules;

—————————————————————————————————————–

File: grid.common.js, function checkValues.  In the line number 389 has an error in the regular expression:

filter = /^(((https?)|(ftp)):\\/\\/([\\-\\w]+\\.)+\\w{2,3}(\\/[%\\-\\w]+(\\.\\w{2,})?)*(([\\w\\-\\.\\?\\\\/+@&#;`~=%!]*)(\\.\\w{2,})?)*\\/?)/i;

An ampersand (marked bold) is wrong character. From the point till the end of regular expression it will be misunderstood. The real problem is a little before. The line should be probably fixed to

filter = /^(((https?)|(ftp)):\\/\\/([\\-\\w]+\\.)+\\w{2,3}(\\/[%\\-\\w]+(\\.\\w{2,})?)*(([\\w\\-\\.\\?\\\\\\/+@&#;`~=%!]*)(\\.\\w{2,})?)*\\/?)/i;

(one should add one more ‘\\’ before ‘/’)

—————————————————————————–

File: jqModal.js, function open. The line 41 look like following

open:function(s,t){var h=H[s],c=h.c,cc='.'+c.closeClass,z=(parseInt(h.w.css('z-index'))),z=(z>0)?z:3000,o=$('<div></div>').css({height:'100%',width:'100%',position:'fixed',left:0,top:0,'z-index':z-1,opacity:c.overlay/100});if(h.a)return F;h.t=t;h.a=true;h.w.css('z-index',z);

It defines variable z two times. The line can be fixed for example to following

open:function(s,t){var h=H[s],c=h.c,cc='.'+c.closeClass,z=(parseInt(h.w.css('z-index'))),o=$('<div></div>').css({height:'100%',width:'100%',position:'fixed',left:0,top:0,'z-index':z-1,opacity:c.overlay/100});if(h.a)return F;h.t=t;h.a=true;h.w.css('z-index',(z>0)?z:3000);

——————————————————————————————————————

File: jqModal.js, function open. The line 49 look like following

 if(c.ajax) {var r=c.target||h.w,u=c.ajax,r=(typeof r == 'string')?$(r,h.w):$(r),u=(u.substr(0,1) == '@')?$(t).attr(u.substring(1)):u;

  r.html(c.ajaxText).load(u,function(){if(c.onLoad)c.onLoad.call(this,h);if(cc)h.w.jqmAddClose($(cc,h.w));e(h);});}

Variables r and u will be defiens two times. The line should be fixed to

 if(c.ajax) {var r=c.target||h.w,u=c.ajax;r=(typeof r == 'string')?$(r,h.w):$(r),u=(u.substr(0,1) == '@')?$(t).attr(u.substring(1)):u;

  r.html(c.ajaxText).load(u,function(){if(c.onLoad)c.onLoad.call(this,h);if(cc)h.w.jqmAddClose($(cc,h.w));e(h);});}

(the comma, atfer difinition of r and u variables, should be replaced to semicolon)

Best regards

Oleg

02/09/2009
04:34
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello Oleg,

Thanks for these. Also I think that these are not small bugs. In setGridWidth it is important correction. Thanks again for this.

About z index in the jqModal - I have changed this little since the z variable is used one more time before the comparation.

Also all fixes are in GitHub.

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

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
91 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