Hi Guys,
I am looking at your example:
[url]Client-Side Requirement - DataProcessor DHTMLX Docs
I need to use arrays for processing rendering so I’m a little confused on how to use the technique above.
Previously I used this for rendering grid:
$account->getDataValues(); //internal class which returns array values
global $db; //db object
$conn = new GridConnector($db->link, "MySQLi");
$conn->render_array(lister($selTagId), "id", "id,name");
function lister($tag_Id){
global $account;
$data = array();
foreach ($account->dataValues as $datakey => $dfv){
if($tag_Id != -1 && $datakey != $tag_Id) continue;
foreach($dfv as $id => $name) {
$data[] = array("id"=> $id, "name" =>$name);
};
};
return $data;
};
Now I’m trying to enable update() ,delete() etc into the file and I’m wondering how should I
change the $connector->configure from your example(below) since no tables are involved nor are there any SQL to be run(I do not have the equivalent of “events” since data comes directly as arrays from a class method($account->getDataValues()) .
$connector->configure("events", "event_id", "start_date, end_date, event_name");
$connector->render();
Hope you can help me out.
Again, thank you for wonderful framework and an even brilliant forum support.
In such case, first parameter of configure has not sense, so can be set any non-empty value.
Second parameter - will be name of id field ( it will be taken from array of data object that you returns in get mehod ), third parameter - list of fields, same as for DB connection
class EventModel{
function get($request){
return array(
array("event_id" => 1, "start_date" => "2014-5-1", event_name => "test")
);
}
}
$connector->configure("dummy", "event_id", "start_date, end_date, event_name");
$connector->useModel(new EventModel());
$connector->render();
Hi Stanislav,
You are brilliant !! Super !!
Thank you. The only thing left to know is ,
Is there a way to use the PHP connector(server side) without a db object at all ?
I’m using MysqlI but having problem with these errors.
Actually if you look at my code, I have another class that does the data operations, so I just need the $action->get_values() inside update/insert/delete and pass it to the $account class functions.
So is there a way to use the php connector without a dataconnection at all in the below code ?
include SITE_ROOT . 'include/connector/grid_connector.php';
include SITE_ROOT . 'include/connector/db_mysqli.php';
DataProcessor::$action_param = "dhx_editor_status"; //for url rewritten sites
Again, Thank you so much for your time,patience and timely help. I appreciate it !
be sure that at end of each operation you have
$action->success();
or
$action->error();
call. Any of them will instruct connector that operation is finished, so it will not execute any operations against the DB.
class EventModel{
function get($update){
/* some custom code here */
$action->success();
}
}
Thanks a lot for all help