Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Alan on Oct 23, 2009 06:13
open dhtmlx forum
Data processor defineAction code

I am using data processor version 1.0 in conjunction with dhtnlmxgrid version 1.6 (both full versions - not free versions)

I have a data processor defined to handle the sending of data to the server and receiving responses back. I have added actions (dataprocessor.defineAction) to handle various errors coming from the server.

In the javascript methods to handle the errors, I need to gain access to the grid that the updates were being applied to, so that I can manipulate the contents of some cells depending on the type of error.

I thought I could do this by accessing the object passed to the dataprocessor.init(grid) method. So my action code is something like

function handleError(obj) {
// Lookup details from obj
var grid = this.obj;
grid.doSomethingUseful();
}

However, it appears that in the action code for a dataprocessor, 'this' does not refer to the dataprocessor.

Is there any way to get to the dataprocessor (or even the grid attached to the data processor) from the action code?
Answer posted by Stanislav (support) on Oct 23, 2009 07:40
Custom actions executed outside of dataprocessor context. It not possible to access the parent object from the code. 
We will fix it in the next version. 

As fast solution you can try to use 

dp.defineAction(some, other)
dp._uActions.obj = dp.obj;


after that, var grid = this.obj; from custom action will work correctly