Forum
Topic RSS
First off. Excellent grid.
I have used the ExtJS grid with a ton of sleepless nights, so KUDOs, Tony.
My latest project I have decided to go the jQuery way. The grid is up and pulling data from a MySQL DB. All's good.
My next task is to add a hyperlink to one of the columns('Document Attached') to open a new window based on the row ID from the DB, this will display a previously uploaded file.
Below is my grid:
$(document).ready(function(){
jQuery("#list").jqGrid({
url:'_getGridApplicationData.php?nd='+new Date().getTime(),
datatype: "json",
colNames:['App. ID','User ID','Created Date','Project Title','Total Amt. Requested','Document Attached'],
colModel:[
{name:'applicationId',index:'applicationId', width:50, align:"center"},
{name:'userId',index:'userId', width:100},
{name:'createdDate',index:'createdDate', width:90},
{name:'projectTitle',index:'projectTitle', width:180, align:"right"},
{name:'totalAmountRequested',index:'totalAmountRequested', width:130, align:"right", formatter:'currency', formatoptions:{thousandsSeparator:","}},
{name:'fileAttached',index:'fileAttached', align:"center", width:140, formatter: 'showlink', formatoptions:{target:"_new", baseLinkUrl:'viewAppFile.php'}}
],
pager: jQuery('#pager'),
rowNum:10,
rowList:[10,20,30],
imgpath:'images',
sortname: 'applicationId',
viewrecords: true,
sortorder: "asc",
caption: "Grant Applications"
}).navGrid('#pager',{edit:false,add:false,del:false});
});
If someone could show me a link to a working example, I could work with it to my needs.
Any help on this is greatly appreciated.
Thanks.
John
It's not who I am underneath, but what I do that defines me.
I have solved my own problem. But I have another issue that may be a newbie problem.
When using 'showlink' in the above example, the href link that is created for the link in the column is followed by 'viewAppFile.php?id='
I wish to change the 'id' to 'applicationId' how do I do this?
Thanks.
JohnM
It's not who I am underneath, but what I do that defines me.
09:32
Moderators
30/10/2007
OfflineHello,
Download the latest version 3.5 alfa 3 from GitHub.
in format options add formatoptions: { idName:'MyIDName'...}
in order to add your custom id name.
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.
01:44
11/05/2009
OfflineHi John,
How did you solve the issue to open it in a new window?
Thanks!
--------------------------------------------------------------------------------
jmcleod3 said:
First off. Excellent grid.
I have used the ExtJS grid with a ton of sleepless nights, so KUDOs, Tony.
My latest project I have decided to go the jQuery way. The grid is up and pulling data from a MySQL DB. All's good.
My next task is to add a hyperlink to one of the columns('Document Attached') to open a new window based on the row ID from the DB, this will display a previously uploaded file.
Below is my grid:
$(document).ready(function(){
jQuery(”#list”).jqGrid({
url:'_getGridApplicationData.php?nd='+new Date().getTime(),
datatype: “json”,
colNames:['App. ID','User ID','Created Date','Project Title','Total Amt. Requested','Document Attached'],
colModel:[
{name:'applicationId',index:'applicationId', width:50, align:"center"},
{name:'userId',index:'userId', width:100},
{name:'createdDate',index:'createdDate', width:90},
{name:'projectTitle',index:'projectTitle', width:180, align:"right"},
{name:'totalAmountRequested',index:'totalAmountRequested', width:130, align:"right", formatter:'currency', formatoptions:{thousandsSeparator:","}},
{name:'fileAttached',index:'fileAttached', align:"center", width:140, formatter: 'showlink', formatoptions:{target:"_new", baseLinkUrl:'viewAppFile.php'}}
],
pager: jQuery('#pager'),
rowNum:10,
rowList:[10,20,30],
imgpath:'images',
sortname: 'applicationId',
viewrecords: true,
sortorder: “asc”,
caption: “Grant Applications”
}).navGrid('#pager',{edit:false,add:false,del:false});
});If someone could show me a link to a working example, I could work with it to my needs.
Any help on this is greatly appreciated.
Thanks.
John
02:21
Moderators
30/10/2007
OfflineHello,
I do not see anything wrong here. What does not work? What is shown when the grid is generated and and you mouse over the link?
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.
Most Users Ever Online: 994
Currently Online:
13 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
Log In
Home