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
3.8 beta fn.fmatter.showlink bug and fix
12/08/2010
08:59
Avatar
cyclone3d
Member
Members
Forum Posts: 10
Member Since:
12/08/2010
sp_UserOfflineSmall Offline

3.8 beta has a bug in fn.fmatter.showlink

It is using the row Id instead of the cellval when building the link.

The bugged line is:

"idUrl = op.baseLinkUrl+op.showAction + '?'+ op.idName+'='+opts.rowId+op.addParam;"

It needs to be replaced with:

"idUrl = op.baseLinkUrl+op.showAction + '?'+ op.idName+'='+cellval+op.addParam;"

12/08/2010
10:39
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

Thanks. Sorry, but this change will not be included.

Imagine how many existing users should change thier code in order to meet this requirment.

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

12/08/2010
18:44
Avatar
cyclone3d
Member
Members
Forum Posts: 10
Member Since:
12/08/2010
sp_UserOfflineSmall Offline

Other then changing that how are you supposed to get the cell data to be sent in the URL with the current code?

Seems kind of non-functional if you need to send the cell data through the URL.

In what instance is somebody going to need to send the row Id unless you have another script to grab the cell data from the column and row?

12/08/2010
21:06
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

You are free to use your own custom formatter:

http://www.trirand.com/jqgridw....._formatter

in order to do what you want.

Kind Regards

Tony Tomov

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.

12/08/2010
23:07
Avatar
cyclone3d
Member
Members
Forum Posts: 10
Member Since:
12/08/2010
sp_UserOfflineSmall Offline

O.k., thanks for the help.

Here is the resulting code in case you are interested. And it should be XHTML 1.1 strict compliant.

"function openChildWindow(cUrl, cName, cFeatures) {



var cName = window.open(cUrl, cName, cFeatures);



return false;

}"

"$.fn.fmatter.jslink = function(cellval, opts) {



var op = {baseLinkUrl: opts.baseLinkUrl, addParam: opts.addParam || "", target: opts.target, idName: opts.idName },

target =



"", idUrl;



if(!isUndefined(opts.colModel.formatoptions)) {

op = $.extend({},op,opts.colModel.formatoptions);

}



if(op.target)

{



if(op.target == 'unique')

{target = op.idName+opts.rowId+cellval;}



// so every different link will open in it's own window





else

{target = op.target;}

}

idUrl =



'onclick="return openChildWindow(' + 'this.href,\'' + target +'\',\''+ op.addParam + '\'); return false;"';



if(isString(cellval) || isNumber(cellval)) { //add this one even if its blank string





return '<a href="' + op.baseLinkUrl + '?' + op.idName + '=' + cellval + '"' + idUrl + '>' + cellval + '</a>';

}



else {



return $.fn.fmatter.defaultFormat(cellval,opts);

}

};



"

Sample colmodel:

{ name: 'itemNum', index: 'itemNum', formatter:'jslink', formatoptions:{baseLinkUrl:'whatever.HTML', idName:'itemNum', target:'unique', addParam:'height=200,width=400'}, width: 80, sorttype: "int" },



17/08/2010
22:22
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

Thanks for this code. I hope it will help.

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

17/08/2010
22:44
Avatar
cyclone3d
Member
Members
Forum Posts: 10
Member Since:
12/08/2010
sp_UserOfflineSmall Offline

I did have to make some changes to the code I orginally posted to make it work properly in IE. IE kept wanting to bring up the href link as well as the js link.

It also makes the new window or window link you clicked on come into focus.

The fixed code is:

"/* for use with jslink */

function





openChildWindow(cUrl, cName, cFeatures) {



var cName = window.open(cUrl, cName, cFeatures);



if (window.focus)

cName.focus();



return false;

}"

"$.fn.fmatter.jslink = function(cellval, opts) {



var op = {baseLinkUrl: opts.baseLinkUrl, addParam: opts.addParam || "", target: opts.target, idName: opts.idName },

target =



"", idUrl;



if(!isUndefined(opts.colModel.formatoptions)) {

op = $.extend({},op,opts.colModel.formatoptions);

}



switch(op.target)

{



case 'unique_by_row':

target = op.idName+opts.rowId+cellval;



// so every different link will open in it's own window





break;



case 'unique':

target = op.idName+cellval;



// if we have a colums where some cell values in the same column that can be exactly the same, such as vendor, publisher, brand, etc.





break;



default:

target = op.target;

}

idUrl =



'onclick="openChildWindow(\'' + op.baseLinkUrl + '?' + op.idName + '=' + cellval + '\',\'' + target +'\',\''+ op.addParam + '\'); return false;"';



if(isString(cellval) || isNumber(cellval)) { //add this one even if its blank string





return '<a ' + idUrl + '>' + cellval + '</a>';

}



else {



return $.fn.fmatter.defaultFormat(cellval,opts);

}

};"

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

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