Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by PMW on Apr 01, 2008 10:08
open dhtmlx forum
DataProcessor

Hello support,

I want to use dataProcessor to save data in DB.I am using java as a server side language.
My requirement is to save all data to DB when one click on save button.
I just gone through the documentation. It looks that data will be available on server side request objecct.
Could you plz explain following points in brief? plz mention what I need to pass as a param in the request.getParameter(param) method.

- cXX - grid columns [XX - is zero based column index]
- gr_id - grid row ID
- userdata blocks will use their names
- !nativeeditor_status - exists and value is "inserted" for insert operation, value is "deleted" for delete, doesn't exist or value is "updated" for update operation


Thanks
Answer posted by Support on Apr 01, 2008 10:33
Basically JSP code will be similar to next

String mode=(String) request.getParameter("!nativeeditor_status");      // type of operation
    if (mode==null) mode="update";
        else if (mode.equals("deleted")) mode="delete";
            else if (mode.equals("inserted")) mode="insert";
                else mode="update";

    String[] columns;
    columns = new String[9];      //column values, for row in question

    columns[0]=(String) request.getParameter("c0");
    columns[1]=(String) request.getParameter("c1");
    columns[2]=(String) request.getParameter("c2");
    columns[3]=(String) request.getParameter("c3");
    String rowId=(String) request.getParameter("gr_id");   //row id

    
    Tasks.updateDB(response,rowId,columns,mode);


If you need a working JSP based sample of dataProcessor usage - please contact us directly at support@dhtmlx.com and provide your ref. number
Answer posted by PMW on Apr 02, 2008 03:07
Thanks.
I have mail you, and waiting for your reply.
In the mean time I tried as per the documentation.
This is my code.

myDataProcessor = new  dataProcessor(path);

myDataProcessor.setUpdateMode("off");
myDataProcessor.init(mygrid);

If I changed two rows  then also I am getting data for single row.          
Actually I want all grid data including attchHeader in the server side whether it is changed or not.
Thanks
Answer posted by Support on Apr 02, 2008 04:11
By default grid generates separate requests for each updated row, if you want to send all data at once, you can use
    grid.setTransactionMode("GET",true);

>>Actually I want all grid data including attchHeader in the server side whether it is changed or not.
You may try to use serialization functionality , it will allow get full grid description in XML format, which can be sent to the server.
Answer posted by PMW on Apr 02, 2008 05:19
Thanks.
Is that mean to get attchHeader data(whether it is changed or not)  on server side a limitation of dataProcessor functionality?
Answer posted by Support on Apr 02, 2008 08:23
dataProcessor send data only updated|added|deleted rows, it will not send any info about header|footer|column structure.