Categories | Question details Back To List | ||
Validation for Dhtmlxgrid Are there any inbuilt validation for Dhtmlxgrid when adding a new row? For example, numbers allowed only or no null value, etc. Answer posted by Support on Aug 25, 2008 06:22 The grid has not any built in validators. Component provides may events, which allow to attach custom code to different events of grid ( onRowCreated for example ) , by which any custom validation can be created If you are using dataprocessor for saving data, it has some basic validation support. http://dhtmlx.com/docs/products/dhtmlxGrid/samples/dataprocessor/savedata_grid.html?un=1219671780000 Answer posted by Valerie on Aug 25, 2008 07:39 How do i attach custom code to different columns because some requires integer validation and others do not allow empty values. Answer posted by Support on Aug 25, 2008 09:21 I'm not sure about exact use-case, which need to be implemented in your case, but for most events grid provides both id and index of cell in question , so it possible to make rules column based. mygrid.attachEvent("onEditCell",function(stage, id, index,value){ if (stage==2){ switch(index){ case 0: check_first(value); break; case 1: check_second(value); break; case 2: check_third(value); break; } } return true; }) Validators of dataprocessor defined on column base, so there is not problem here as well. Answer posted by Valerie on Aug 26, 2008 00:28 The id and index is used to identify a particular cell in the grid table right? So if i specify just the index which represents the whole column, i can use it to do a particular validation. Am i right? Answer posted by Support on Aug 26, 2008 07:02 Any cell in grid can be accessed by knowing rowID and column Index. Most API methods and in-grid events based on such parameters. >>which represents the whole column, i can use it to do a particular validation You can itterate through all rows and check necessary column only. http://dhtmlx.com/docs/products/dhtmlxGrid/doc/articles/Iterating_through_grid.html#grid_art_iteratingthrough Answer posted by Valerie on Aug 29, 2008 08:10 I think i get it, thanks. |