fedemotta / yii2-widget-datatables

DataTables widget for Yii2
MIT License
35 stars 28 forks source link

How to use it? #20

Closed i-panov closed 6 years ago

i-panov commented 6 years ago

Hi, I'm trying to figure out the DataTables for my project on Yii2. I have your widget, but I do not understand how to use it. Very few examples in README. For example, the following code is shown there:

$searchModel = new ModelSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);

But what is this $searchModel? Or is it an ordinary ActiveRecord, and I'm asked to search for myself? It would be nice if-then there was a search (for all the parameters required for this are passed in the request as far as I understand). And what for $dataProvider again you use in the example? Do you need to implement it yourself?

fedemotta commented 6 years ago

It is an ordinary ActiveRecord. You can use it like a standard widget. See there are some examples: http://www.yiiframework.com/doc-2.0/guide-output-data-widgets.html