Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Ivo Marvan on Apr 09, 2008 08:51
open dhtmlx forum
own cell editor for grid based on combo/select box

I need define new cell editor based on “coro” cell editor (or on some other combo/select box)
----------------------------------------------------------------------------------------
I am using JavaScript definition my new cell editor with name "mytest":

function eXcell_mytest(cell){
this.base = eXcell_coro;
this.base(cell);
}

eXcell_mytest.prototype = new eXcell_coro;

(Functions “edit” , “getValue”, “setValue” and “detach” can be written later).
----------------------------------------------------------------------------------------
For definition of columns in dhtmlxGrid (and loading data) I am using “grid.loadXML(‘getData.php’)”. XML content is like:

    <column id="model" type="mytest">Test<editable>false</editable>
    <option value="1">Title A</option>
    <option value="2">Title B</option>
    <option value="3">Title C</option>
    ….
    </column>
    …
    </head>
    <row id="1"><cell>2</cell></row>
<row id="2"><cell>3</cell></row>
<row id="3"><cell>1</cell></row>

-------------------------------------------------------------------------------------------------
| I see now in grid values (2,3,1,…) instead content (‘Tiltle B’, ‘Tiltle C’, ‘Tiltle A’). |
-------------------------------------------------------------------------------------------------

Is some way, how defining my own cell editor based on combo/select box?
Thanks, Ivo
Answer posted by Support on Apr 10, 2008 02:44
The combo excell has custom set and get methods, so it not such simple task to create a custom version of it.
Please check attached sample
Attachments (1)
Answer posted by Ivo Marvan on Apr 23, 2008 02:38

I found by experiments, that name of custom cell editor based on “coro” must start with “co string.

Name “mytest“ in my example above (in question) don’t work. But same code with name “co_mytest” works.

Probably this name can contain string “co” anywhere inside.

I thing, that relevant code in function:

dhtmlXGridObject.prototype._parseHead = function(xmlDoc) {

is

                           for (var i=0; i<headCol.length; i++){

                                         if ((this.cellType[i].indexOf('co')==0)||(this.cellType[i]=="clist")){

(line 4483 in my version of file: “dhtmlxGrid/sources/dhtmlxgrid.js).

….

Answer posted by Support on Apr 23, 2008 05:13
Actually the name must start from anything, but inline option tags will be processed only for column types started from co
Basically this feature was purposed for existing co|coro|combo types