Set skin through XML

Hi,

I would like to set skin of the grid through XML and based on the skin selected i would like to do some changes in the values. How can i acheive the functionality.

i.e. If i select the skin to be XP then i would like to set the rows of the grid to be green.



Syntax that i am making use of

    Response.Write “<script type=”“text/javascript”">"

    Response.Write “<div style=”“margin:20px;”">"

    Response.Write “Choose skin to apply:”

    Response.Write “<select onchange=”“mygrid.setSkin(this.value)”">"

    Response.Write “<option value=”“gray”">gray"

    Response.Write “<option value=”“mt”">mt"

    Response.Write “<option value=”“xp”">xp"

    Response.Write “<option value=”“clear”">clear"

    Response.Write “<option value=”“modern”">modern"

    Response.Write “<option value=”“light”“selected>light”

    

    Response.Write “”

    Response.Write “”

If this.value=xp then

        SkinColor=“green”

        end If

    Response.Write “”



Is my syntax correct?

You can execute any grid API command from afterInit section of XML


   
       … configuration of grid here…
       xp
   
… any data here


The look of grid for each skin can be adjusted in dhtmlxgrid.css , please check
    dhtmlx.com/docs/products/dht … _cust_skin


Hi,



Thanks for the reply.



I want to set the background color of the row in the grid as and when i change the skin of the grid. So, i want to set the values in the XML. I dont want to change the CSS file. Is this possible to acheive?



Suppose i change the skin of the grid to ‘xp’ then i want to set the background color of certain rows to ‘Green’.



Similarly if i change the skin of the grid to ‘light’ then i want to set the background color of certain rows to ‘red’.



How can i acheive the above mentioned functionality by using the syntax style as mentioned in my query earlier?

There is no any inner event on skin changing , so you can’t catch the moment indirectly
In case of direct coding you can use
    grid.setSkin(name)
    if (name==“xp”){
       grid.setRowColor(some,“green”);
    }

The more elegant way is to define special css rules

In XML
        …
In HTML

    .gridbox_xp .special{

       background-color:green !important;

    }
    .gridbox_light .special{

       background-color:red !important;

    }