Forum

July 12th, 2025
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
formatter:'showlink' or 'link' to open new window based on retrieved DB ID
04/05/2009
13:32
Avatar
jmcleod3
Member
Members
Forum Posts: 33
Member Since:
04/05/2009
sp_UserOfflineSmall Offline

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.

04/05/2009
22:09
Avatar
jmcleod3
Member
Members
Forum Posts: 33
Member Since:
04/05/2009
sp_UserOfflineSmall Offline

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.

05/05/2009
09:32
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

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.

05/05/2009
10:27
Avatar
jmcleod3
Member
Members
Forum Posts: 33
Member Since:
04/05/2009
sp_UserOfflineSmall Offline

Thanks for the reply.

I had already updated to the latest version to solve a previous issue.

I went into fmatter.js to solve this problem.

I hope you don't mind, I changed it to meet our needs.

Consider the problem closed.

JohnM

It's not who I am underneath, but what I do that defines me.

21/05/2009
01:44
Avatar
casperd
Member
Members
Forum Posts: 76
Member Since:
11/05/2009
sp_UserOfflineSmall Offline

Hi 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


25/05/2009
02:21
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

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.

Forum Timezone: Europe/Sofia

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

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information