S
S
Sergey Kulagin2016-04-18 00:18:48
Yii
Sergey Kulagin, 2016-04-18 00:18:48

How to integrate webix into Yii2?

I'm going to use Webix elements in Yii2. In particular, I want to make it possible to edit the table (datatable) by clicking the mouse.
The whole thing is built in quite simply: I include js and css in the header, and if you write the data (data) manually, everything works. But I can’t figure out how to pull data from MySQL, and save it after editing (
On the offsite it says: “Webix widgets support several integration options with server code: the ability to use the REST API with library components, as well as any MVC framework (MVC. Net, Ruby on Rails, Yii, etc.)".
If I understand correctly, you need to convert the selected table from the database to json.
I do this:
$data = self::find()->all();
$datatable = json_encode($data, JSON_UNESCAPED_UNICODE);
but at the output I get: [{},{},{},{}]
And how then to save the edited fields in the database?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
AlikDex, 2016-04-18
@AlikDex

obviously decode the json, validate the data and write to the table as usual.
Will help with this:
https://github.com/yiisoft/yii2/blob/master/docs/g...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question