getUserData Custom Fields

Hey guys,

I am using the connector to load my tree data and I am capturing some fields in the $extra column, i.e. “checked,open,level,note,manual”.

require("codebase/tree_connector.php"); $tree = new TreeConnector($res); $tree->enable_log("temp.log",true); function custom_format($item){ if ($item->get_value("checked")>0) $item->set_check_state(1); if ($item->get_value("open")>0) $item->set_attribute("open",1); } $tree->event->attach("beforeRender",custom_format); $tree->render_table("tree","treeId","treeName","checked,open,level,note,manual","parentId");

I would like later reference those fields in an onClick event. But for testing I am trying to get this button to work and reference the fields.

<input type="button" name="some_name" value="get field" onClick="alert(tree.getUserData(tree.getSelectedItemId(),'level'));">

I have the dataprocessor working becuase I can up the database with these two buttons:

<input type="button" name="some_name" value="update" onClick="dp.sendData();"> <input type="button" name="some_name" value="add item" onClick="tree.insertNewItem((tree.getSelectedItemId()||'0'),(new Date()).valueOf(),'item')">

Thanks so much for all the great tips and support.

extra attributes is not sent to client side automatically, but you can add some code to beforeRender handler as

   function custom_format($item){
             $item->set_userdata("level", $item->get_value("level"));

after such code , the level userdata will be available on the client side.