How can i push arrays into the Field::inst on load
How can i push arrays into the Field::inst on load
ziv@kpmbro.com
Posts: 73Questions: 28Answers: 4
Hi
How can i add some data into the "data" object when loading the page from the server side(php)?
in this example i want to add to "filtering" array to the object.
something like that:
{
data: ...
draw: ...,
recordsTotal: ...,
recordsFiltered: ...,
filtering: {
"queue_status.task_name": [ 'ziv task', 'test', ... ],
"queue_status.rabbit_queue_status": [ 'good', 'failed' ],
...
}
}
so i could print the filters on "initComplete"
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Are you using the Editor PHP libraries? If so, use the
Editor->data()
method rather than theEditor->json()
method. The former will return an array that you can modify - e.g.Allan
Hey allan.
yes i am using the Editor PHP libraries.
my code is building the fields dynamic like this:
$this->editor_instance->fields(Field::inst($fields_key));
$this->editor_instance->fields(Field::inst($fields_key)->options( $table_name_to_join, 'id', $field_to_join ));
i tried the data method and it didnt add to the object.
$this->editor_instance->data(array("k"=>"v"));
how can i to the "options" array?
ahh i got it now, you right its working ! :)
Thanks allan you saved me agin :))