Forum
08:59
12/08/2010
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;"
10:39
Moderators
30/10/2007
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.
18:44
12/08/2010
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?
21:06
Moderators
30/10/2007
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.
23:07
12/08/2010
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" },
22:22
Moderators
30/10/2007
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.
22:44
12/08/2010
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);
}
};"
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.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66