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
Custom Cell Renderers
10/10/2008
07:43
Avatar
jonnycattt
Member
Members
Forum Posts: 14
Member Since:
08/10/2008
sp_UserOfflineSmall Offline

I've worked a lot with the EXTJS grid, and one of the things I've come to love is the "renderer" functionality for a cell. This provides an easy way to do custom cell formatting. Basically, in the columnmodel, you specify a renderer. this is a javascript function that you write.

the grid, when it sees a custom renderer is attached, passes the contents of the grid through the renderer function, passing in the cell value, the json object for that entire row, and some other stuff.

in this way, you can do dollar formatting, turn 1/0 into yes/no, and all kinds of other goodness.

Does jqGrid have this kind of custom cell formatting functionality?

thanks.

Marc

10/10/2008
07:59
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

It is not direct cell renderer but requires some little code.

Imagine we must known the input and output format for that cell -

(what we expect and what we put)

The reason that I do not put such renderer is the complexity and at first time the speed, but jqGrid have a lot of methods to do that.

use afterInsertRow event again with setCell method and you can do what you want here.

afterInsertRow : fiunction (rowid, adata) {

if( some_condition ) {

jQuery("#gridid").setCell(rowid,'cellname',myformater(adata.cellname));

}

}

function myformater(input) {

// do something here

return new_formated_value

}

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.

10/10/2008
08:09
Avatar
jonnycattt
Member
Members
Forum Posts: 14
Member Since:
08/10/2008
sp_UserOfflineSmall Offline

thanks Tony. I'll give it a shot!

10/10/2008
13:52
Avatar
jonnycattt
Member
Members
Forum Posts: 14
Member Since:
08/10/2008
sp_UserOfflineSmall Offline

Hey Tony,

  I added this to my grid:

afterInsertRow: function(rowid,rowdata){
                console.log(arguments);           
                formatCell(rowid,rowdata);
            }

But in the arguments, i'm getting an empty array for rowdata. rowid passes in fine though.

ideas?

10/10/2008
13:58
Avatar
jonnycattt
Member
Members
Forum Posts: 14
Member Since:
08/10/2008
sp_UserOfflineSmall Offline

ugggg... ignore that! i see the error of my ways.

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

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