Forum
November 2nd, 2014
A
A
A
Topic RSS
Offline
The forums are currently locked and only available for read only access


Cell Background Color
10/05/2009
08:45
08:45

akremedy
California, USA
Member
Members
Forum Posts: 37
Member Since:
16/12/2008
16/12/2008

Genti, use setCell (see Basid Grids > Methods in docs for more information). Here is a working example that sets the background color of one cell to red on a specific condition:
jQuery(document).ready(function(){
jQuery("#mylinks_grid_table").jqGrid({
afterInsertRow:function(row_id,rData) {
if(rData['share'] == 'yes') {
jQuery("#mylinks_grid_table").setCell(row_id,'share','',{background:'red'},{title:'This link has been shared'});
}
},
caption: 'My Family\\'s Links',
colModel :[
{name:'id', index:'id', width:40, align:'center',editable:false,editoptions:{readonly:true,size:10},hidden:true},
{name:'flag', index:'flag', width:50, align:'center',editable:false,editoptions:{readonly:true},hidden:false},
{name:'added', index:'added', width: 70, editable:false, sortable:true, hidden:true},
{name:'share', index:'share', width: 60, align:'center',editable:true,edittype:"checkbox",editoptions:{value:"yes:no"}},
{name:'name', index:'name', width: 200, editable:true,},
{name:'link', index:'link', width: 301, editable:true, formatter:'link',formatoptions:{target:"_new"},editrules:{url:true}}
],
jQuery("#mylinks_grid_table").jqGrid({
afterInsertRow:function(row_id,rData) {
if(rData['share'] == 'yes') {
jQuery("#mylinks_grid_table").setCell(row_id,'share','',{background:'red'},{title:'This link has been shared'});
}
},
caption: 'My Family\\'s Links',
colModel :[
{name:'id', index:'id', width:40, align:'center',editable:false,editoptions:{readonly:true,size:10},hidden:true},
{name:'flag', index:'flag', width:50, align:'center',editable:false,editoptions:{readonly:true},hidden:false},
{name:'added', index:'added', width: 70, editable:false, sortable:true, hidden:true},
{name:'share', index:'share', width: 60, align:'center',editable:true,edittype:"checkbox",editoptions:{value:"yes:no"}},
{name:'name', index:'name', width: 200, editable:true,},
{name:'link', index:'link', width: 301, editable:true, formatter:'link',formatoptions:{target:"_new"},editrules:{url:true}}
],
Hope that helps,
Adam
Forum Timezone: Europe/Sofia
Most Users Ever Online: 715
Currently Online:
89 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