Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Pradeep on Jan 09, 2010 04:20
open dhtmlx forum
How to set maxlength to a cell in DHTMLXGrid

Hi,

We are using Professional version of DhtmlxGrid. I want to know how to set maxlength to a cell in DHTMLXGrid.
Is it possible to fix the length of specific cell at the time of initilaizationn of grid? or is there any specific function provided?

Note: Other that validating the cell value length in edit event using javascript.

Please let me know ASAP.

Thnaks in advance,
Pradeep
Answer posted by Alex (support) on Jan 11, 2010 10:13

Hello

there isn't a public solution.

For "ed" column type you can try to use the following:

mygrid.attachEvent("onEditCell",function(stage,rowId,cellIndex){
  if(stage==1&&cellIndex==INDEX){ /*here INDEX is column index*/
     mygrid.editor.obj.onkeypress = function(){
          return mygrid.editor.obj.value.length < 10;
     }
  }

  return true
})