Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Ing. Michal Repasky on Oct 29, 2009 01:52
open dhtmlx forum
Own dhtmlx grid cell type

Hi,
thanks for previos reply (http://dhtmlx.com/docs/products/kb/index.php?s=normal&q=12595&a=20278).

I implement own dhtmlx grid cell with html input fragment like this:

function eXcell_input(cell){ //excell name is defined here
        if (cell){ //default pattern
            this.cell = cell;
            this.grid = this.cell.parentNode.grid;
            eXcell_ed.call(this); //use methods of "ed" excell
        }
    
        this.setValue=function(val){
            this.setCValue("<input type='text' value='"+val+"' size='3' onkeypress='return checkKeyPressValue(event)' >",val);
        }
        
        this.getValue=function(){
            return this.cell.firstChild.value;                     // get input val
        }
    }
    
    eXcell_input.prototype = new eXcell;                     // nest all other methods from base class
    
    function checkKeyPressValue(e) {
        var characterCode;                                        //literal character code will be stored in this variable
        if (e && e.which) {                                     //if which property of event object is supported (NN4)
            e = e;
            characterCode = e.which;                             //character code is contained in NN4's which property
        } else {
            e = event;
            characterCode = e.keyCode;                            //character code is contained in IE's keyCode property
        }
        if (characterCode >= 48 && characterCode <= 57) {         //if generated character code is between 48 (number 0) and 57 (number 9)
            return true;
        } else {
            return false;
        }
    }
    
But i have a problem with loading cell value over API function "cellByIndex",
dhtmlxGrid shut down on undefined value of cell property in function "cells4:function(cell){" online 865 of file dhtmlxdrif.js.

I dont know if is not needed to implement next prototype function for renred row or something like that.

Can you please give me some advice? Thanks, Michal.
Answer posted by Support on Oct 29, 2009 04:55
Unfortunately we cannot reproduce this issue locally. Please check if parameters of cellByIndex method is existed row and cell indexes.