Java connector documentation error

I am trying to do something as described in your docs at:

[url]Start DHTMLX Docs

Specifically the docs give the following snippet of code:

[code]//fully custom code
class updateBehavior extends ConnectorBehavior{
private GridConnector conn;
public updateBehavior(GridConnector conn){
this.conn = conn;
}

    @Override
public void beforeUpdate(DataAction action) {
         String price = data.get_value("price");
         String id = data.get_value("id");
         conn.sql.query("UPDATE some_table SET price='"+price+"' where id="+id);
         data.success(); //if you have made custom update - mark operation as finished
}

}
conn.event.attach(new updateBehavior(conn));
[/code]

Problem is the data variable does not exist and I guess it could refer to action. But more importantly the conn.sql.query(…) method does not exist.

Can you please provide a working example.

Thank you!

yes, you need to use “action”, not the “data”, sorry for inconvenience
As for “conn”, when you are creating Behavior object, you are providing connector, which is store in “conn” variable, and must be accessible in any other method of Behavior class.

Yes, thanks I understand that but that’s my point the conn.sql.query(…) method is not available :frowning:

Also, it seems according to the javadocs the access to “query” does not exist.


Try to change

conn.sql.query("UPDATE some_table SET price='"+price+"' where id="+id);

as

DBDataWrapper db = (DBDataWrapper)conn.sql; db.query("UPDATE some_table SET price='"+price+"' where id="+id);

Hi Stanislav,

Yes that works a treat. Thank you.

Might be worth updating the docs :smiley:

Sure, we will update the docs