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
How to add style to a column
25/10/2008
06:57
Avatar
diptendu
Member
Members
Forum Posts: 17
Member Since:
21/10/2008
sp_UserOfflineSmall Offline

Helllo,

How can I add a style (cell back ground colour, font, etc.) to a column ?

The Column Model does not have any attribute for style.

Regards.

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

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

Hello

Use afterInsertRow (or loadComlete) with setCell method . With setCell method you can set a class.

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.

25/10/2008
07:32
Avatar
diptendu
Member
Members
Forum Posts: 17
Member Since:
21/10/2008
sp_UserOfflineSmall Offline

Helllo,

Is it possible to handle this by generating the XML data with the

inline style information which will override the default from "grid.css"

<cell >  <div >  data1   style=" ... " </div>  </cell>

<cell>   <div>  data2    style=" ..same style .." </div>  </cell>

Regards.

29/10/2008
02:26
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

Yes this is IMHO the right way. Do not forget to enclose this in

CDATA section. See examples.

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/11/2008
13:56
Avatar
frap
Member
Members
Forum Posts: 3
Member Since:
01/11/2008
sp_UserOfflineSmall Offline

How would one style column headings?

Say, if I'd like a heading to appear right aligned instead of left…

01/11/2008
15:22
Avatar
donb
Member
Members
Forum Posts: 24
Member Since:
11/10/2008
sp_UserOfflineSmall Offline

frap said:

How would one style column headings?

Say, if I'd like a heading to appear right aligned instead of left…


Looks like <div id='jqg_<colname'> for all headings, so define styles accordingly and that should do it. (where <colname> is the name in the column definitions for the grid.

02/11/2008
04:27
Avatar
frap
Member
Members
Forum Posts: 3
Member Since:
01/11/2008
sp_UserOfflineSmall Offline

Although I didn't got this to work, I don't think it can be just a simple css tweak. My skills are realy limited, however I could identify where in the grid.css the table headings (all of them) are aligned and just changed it.

The result wasn't pretty though, as jqGrid reserves space on the heading for the sorting controls so that have to be accounted for... eg perhaps they should revert to the left if right alignment is chosen... And centering the headings looked plain ugly (and not centered with regards to the column borders...)

02/11/2008
06:59
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

I recomend first to read the docs. You can use setLabel  method for

this purpose. There is example in the example page

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.

03/11/2008
03:41
Avatar
frap
Member
Members
Forum Posts: 3
Member Since:
01/11/2008
sp_UserOfflineSmall Offline

Thanks Tony.

I was actually expecting something like the colModel structure for the labels, hence I didn't look at the methods thoroughly.

However, still isn't what I expected…

Image Enlarger

full size image: http://img208.imageshack.us/im.....ridei1.jpg[Image Can Not Be Found]

'Points' column is right aligned and 'Villages' should be centered.

I think the width of the control for resizing the windows isn't taken into acount for centering, while for right aligning… hmm…

But I guess I can live with this :)

04/11/2008
02:20
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

The reason for this is that the properties are applied to the

th element and not to div element which is whitin th.

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.

23/03/2009
14:59
Avatar
MiB
MiB
Member
Members
Forum Posts: 8
Member Since:
23/03/2009
sp_UserOfflineSmall Offline

Hi!

How can i add custom id, class to table and rows. How can i creat it with JSON?

"while($row = mysql_fetch_array($result,MYSQL_ASSOC)) {   $responce-&gt;rows[$i]['id']=$row[id]; $responce-&gt;rows[$i]['cell']=array($row[id],$row[invdate],$row[name],$row[amount],$row[tax],$row[total],$row[note]); $i++; }"

$responce-&gt;rows[$i]['class'] = ?

array(array($data, 'id' =>'rowid', 'class' => 'rowclass')), $row[invdate],$row[name]

Or, do i have to convert a html table, but how can i add after it custom function like cell edit, tablsesorter, etc.

THX!

24/03/2009
06:20
Avatar
MiB
MiB
Member
Members
Forum Posts: 8
Member Since:
23/03/2009
sp_UserOfflineSmall Offline

Tony, I am waiting for ur answer :/

26/03/2009
02:55
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

The answer is just above and in this forum. You just need to read and use find button in the forum. This topic is discussed many times.

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: 715

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