Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

defaultOrder being ignored by DataTables #18

Open
doublehops opened this issue Jul 4, 2017 · 1 comment
Open

defaultOrder being ignored by DataTables #18

doublehops opened this issue Jul 4, 2017 · 1 comment

Comments

@doublehops
Copy link

I have the following in the model's search method:

$dataProvider = new ActiveDataProvider([
    'query' => $query,
    'sort' => ['defaultOrder' => ['id' => 'DESC']],
]);

This works fine with GridView::widget but seems to be ignored by DataTables. Is this a known problem? I'm having trouble finding the cause.

@archimodecl
Copy link

In view index.php... add in clientOptions
"order"=>[[column,"type"]]
example:

$dataProvider, 'filterModel' => $searchModel, 'clientOptions' => [ // "lengthMenu"=> [[20,-1], [20,Yii::t('app',"All")]], "info"=>true, "responsive"=>true, "order"=> [[ 2, "desc" ]]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants