Personal tools
| Home | sandbox | dhtmlxGrid | samples | cell_types | colorpicker_grid
Document Actions

colorpicker_grid

Sample: dhtmlxGrid Colorpicker eXcell dhtmlxGrid main page
X

You can implement Colorpicker as cell editor


 
<div id="gridbox" width="600px" height="250px" style="background-color:white;overflow:hidden"></div>
<script>
 
        mygrid = new dhtmlXGridObject('gridbox');
        ...
        mygrid.setHeader("Color Name,Color");
        mygrid.setInitWidths("80,*")
        mygrid.setColAlign("left,center")
        mygrid.setColTypes("ed,cp");
        mygrid.setColSorting("str,str")
        ...
        mygrid.init();
        mygrid.loadXML("colors.xml");
</script>

Current example also uses onCellEdit event handler to populate corresponding text cell with color value chosen with color picker and vice versa:
 
function doOnColorChanged(stage,rId,cIn){
    if(stage==2){
        if(cIn==0){
            mygrid.cells(rId,1).setValue(mygrid.cells(rId,0).getValue())
        }else if(cIn==1){
            mygrid.cells(rId,0).setValue(mygrid.cells(rId,1).getValue())
        }
    }
    return true;
}
mygrid.setOnEditCellHandler(doOnColorChanged)

Powered by Plone CMS, the Open Source Content Management System