Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by acabrera on Nov 04, 2009 06:43
open dhtmlx forum
setColumnColor

For some reason, setColumnColor does not appear to change anything in my dhtmlxgrid. Does this have something to do with the style overriding the setColumnColor method?


        incomingloadsgrid = new dhtmlXGridObject('incomingloadsgrid');
        incomingloadsgrid.setImagePath("/codebase/imgs/");
        incomingloadsgrid.setHeader("<img src='/resources/images/info_icon.png' width='16'>,Load,Carrier,Origin,Pickup Date,Delivery Date,Status,Carrier Quote,Carrier Adjst.,Carrier Rate,Invoice Number,Invoice Received,Container Number,Action,#master_checkbox");
        incomingloadsgrid.setInitWidths("20,40,*,*,55,55,55,50,50,50,40,65,55,55,30");
        incomingloadsgrid.setColAlign("center,center,left,left,left,left,left,right,right,right,right,right,center,center,center");
        incomingloadsgrid.setColTypes("ro,ro,ro,ro,ro,ro,ro,ed,ed,ed,ed,ed,ed,ro,ch");
        incomingloadsgrid.setSkin("myskin");
        incomingloadsgrid.init();
incomingloadsgrid.parse(incomingloadDataJS,"jsarray");
        incomingloadsgrid.setColSorting("str,int,str,str,str,str,str,str,str,str,int,str,str,str,str");
        incomingloadsgrid.attachEvent("onRowSelect", onRowSelected);
        incomingloadsgrid.attachEvent("onMouseOver", onMouseOver);
        incomingloadsgrid.attachEvent("onCheck", onCheck);
        incomingloadsgrid.enableEditEvents(true, true, true);
        incomingloadsgrid.setColumnColor(",,,,,,,blue,#d5f1ff,orange,,,,,");

        //turn QuickPay rows red
        for (i = 1; i <= incomingloadDataJS.length; i++) {
            if (incomingloadData[i - 1]['quick_pay'] == "1") {
                incomingloadsgrid.setRowTextStyle(i, "color:red;");
            }
        }
Answer posted by dhxSupport on Nov 05, 2009 06:15
Unfortunately we cannot reproduce this issue locally. Probably setColumnColor() is blocked by custom skin. Please try to use default one and check if method will work.
Answer posted on Nov 05, 2009 06:20
Disabling the custom skin did not work.  The columns still will not change color
Answer posted by Alex (support) on Nov 06, 2009 08:36

Hello, 

method setColumnColor should be called before data is added:

incomingloadsgrid.setColumnColor(",,,,,,,blue,#d5f1ff,orange,,,,,");

incomingloadsgrid.parse(incomingloadDataJS,"jsarray");

Answer posted on Nov 10, 2009 21:21
Tried that and it still doesn't work.  Any other ideas?
Answer posted by Alex (support) on Nov 11, 2009 02:33

Could you please expain in detail what result do you want to achieve ?

The setColumnColor method sets backgroud color of a certain column. If you need to change some other styles, please use setRowTextStyle or setCellTextStyle methods.

Answer posted on Nov 11, 2009 06:02
I want to set the background color of certain columns.  I am trying to use the setColumnColor method but nothing changes in the grid.  I have tried changing skins, removing all other methods, moving the method before init, and so on.
Answer posted by Alex (support) on Nov 11, 2009 08:19
The issue wasn't reproduced locally. Please, see attached sample
Attachments (1)