Categories | Question details Back To List | ||
DataProcessor - change/add data before sending to server Hello I am trying to implement a java based data processor. I am using Servlets for processing the data sent to the server. my clientside looks like this: mygrid = new dhtmlXGridObject('gridbox'); mygrid.setImagePath("webresources/JS/dhtmlxGrid/codebase/imgs/"); //init dataprocessor and assign verification function //specify server update processor - member of dhtmlxGridDataProcessor library (just check the path) or your own myDataProcessor = new dataProcessor("http://localhost:8080/FooBar/servlet/TrainerListServlet"); //use column IDs instead of column indexes naming request parameters myDataProcessor.enableDataNames(true); myDataProcessor.setUpdateMode("cell");//available values: cell (default), row, off //set error handler (handler for action with type "error") myDataProcessor.defineAction("error",myErrorHandler); //specify transaction method - POST or GET (default is GET) myDataProcessor.setTransactionMode("POST"); mygrid.init(); mygrid.setSkin("light") mygrid.loadXML("http://localhost:8080/FooBar/servlet/TrainerListServlet?do=list"); mygrid.setSizes(); myDataProcessor.enableDebug(true); myDataProcessor.init(mygrid); //Example of error handler. It gets <action> tag object as incomming argument. function myErrorHandler(obj){ alert("Error occured.\n"+obj.firstChild.nodeValue); myDataProcessor.stopOnError = true; return false; } My Questions/Problems: 1) I do get all row data BUT I do not get "!nativeeditor_status" in my Servlet when updating a cell. 2) How can i manipulate the parameters that are actually sent to the server via HTTP? I tried setting an update handler with myDataProcessor.setOnBeforeUpdateHandler(myUpdateHandler); function myUpdateHandler(rowId,opType) { mygrid.setUserData("","foo","bar"); //variant 1 mygrid.setUserData(rowId,"foo","bar");//variant 2 } In variant 1 i am trying to set a new global data and in variant 2 i am trying to add a new row bases user data. both do not work in this stage. After Debugging into the update mechanism i realized that the user data is added to the URL BEFORE calling the "BeforeUpdateHandler" (does this make sense?). I must be very flexible on this part as i want my Servlet to be a sort of "FrontController" that dispatches the proccessing actions according to the operation requested. These operations can be more than "insert","update","delete", ... e.g. "mySpecialOperation" and therefor i need something like "...?do=mySpecialOperation&data=..." in the URL. Hope you get the idea of what i am trying to do... 3) Do you have any experience in integrating with any java web frameworks like Spring MVC, WebWork, Java Server Faces, Ajax4Jsf,...? If so, do you have an explanatory source code? Thank you very much, BR s.r. Answer posted by Support on Jan 31, 2008 08:17 >>1) I do get all row data BUT I do not get "!nativeeditor_status" in my Servlet when updating a cell. This is not really an error, if data updated !nativeeditor_status may be empty|not specified >>is added to the URL BEFORE calling the "BeforeUpdateHandler" (does this make sense?). I agree that it not very useful, but it pretty use to change behavior , without affecting any other functionality. Please contact as directly at support@dhtmlx.com if you need updated version, where onBeforeUpdate occurs before request string building, so it possible to set custom params. >>3) Do you have any experience in integrating with any java web frameworks like Spring MVC, WebWork, Java Server Faces, Ajax4Jsf,...? If so, do you have an explanatory source code? There is no samples for specific frameworks, but if you need a JSP based sample for dataprocessor - just contact at support@dhtmlx.com and provide your ref. number. |