{"action":"created","issue":{"url":"https://api.github.com/repos/himiklab/yii2-sortable-grid-view-widget/issues/15","labels_url":"https://api.github.com/repos/himiklab/yii2-sortable-grid-view-widget/issues/15/labels{/name}","comments_url":"https://api.github.com/repos/himiklab/yii2-sortable-grid-view-widget/issues/15/comments","events_url":"https://api.github.com/repos/himiklab/yii2-sortable-grid-view-widget/issues/15/events","html_url":"https://github.com/himiklab/yii2-sortable-grid-view-widget/issues/15","id":98878706,"number":15,"title":"Calling unknown method: app\\models\\[ModelName]::tableName()","user":{"login":"kaynewilder","id":11188562,"avatar_url":"https://avatars.githubusercontent.com/u/11188562?v=3","gravatar_id":"","url":"https://api.github.com/users/kaynewilder","html_url":"https://github.com/kaynewilder","followers_url":"https://api.github.com/users/kaynewilder/followers","following_url":"https://api.github.com/users/kaynewilder/following{/other_user}","gists_url":"https://api.github.com/users/kaynewilder/gists{/gist_id}","starred_url":"https://api.github.com/users/kaynewilder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaynewilder/subscriptions","organizations_url":"https://api.github.com/users/kaynewilder/orgs","repos_url":"https://api.github.com/users/kaynewilder/repos","events_url":"https://api.github.com/users/kaynewilder/events{/privacy}","received_events_url":"https://api.github.com/users/kaynewilder/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-08-04T03:07:43Z","updated_at":"2015-08-04T15:26:49Z","closed_at":null,"body":"Please help me. \r\n\r\nI am getting this error:\r\n**Calling unknown method: app\\models\\PayrollItems::tableName()**\r\n\r\nin C:\\wamp3\\www\\iaoy-sprobe-svn\\vendor\\himiklab\\yii2-sortable-grid-view-widget\\SortableGridBehavior.php – yii\\base\\Component::__call('tableName', [])\r\n\r\nLine 74\r\n`$maxOrder = $model->find()->max($model->tableName() . '.' . $this->sortableAttribute);`\r\n\r\nHere's my `actions` in my controller:\r\n````\r\n    public function actions()\r\n    {\r\n        return [\r\n            'sort' => [\r\n                'class' => SortableGridAction::className(),\r\n                'modelName' => PayrollItems::className(),\r\n                // 'tableName' => 'payroll_items',\r\n            ],\r\n        ];\r\n    }\r\n````\r\nModel:\r\n````\r\n    public function behaviors()\r\n    {\r\n        return [\r\n            'sort' => [\r\n                'class' => SortableGridBehavior::className(),\r\n                'sortableAttribute' => 'sortOrder',\r\n                // 'query' => self::find(),\r\n            ],\r\n        ];\r\n    }\r\n````\r\nGridView:\r\n````\r\n    <?php echo SortableGridView::widget([\r\n        'dataProvider' => $dataProvider,\r\n       // 'filterModel' => $searchModel,\r\n        'columns' => [\r\n            ['class' => 'yii\\grid\\SerialColumn'],\r\n        \t'code_type',\r\n        \t'payroll_name',\r\n            [   \r\n                'label' => 'Action',    \r\n                'content' => function ($model, $key, $index, $column) {\r\n                if ( ($model->company_id != null) && ($model->active == 1) ) { \r\n            \t    if(in_array($model->payroll_name, array(\"CPF\", \"SINDA\", \"MENDAKI\", \"FWL\", \"SDL\", \"CDAC\", \"ECF\", \"MBMF\", \"Union Fund\", \"Insurance\", \"Unpaid Leave\",\"Deductions\", \"NSMen Pay\"))){\r\n                        return Html::button('<span class=\"glyphicon glyphicon-eye-open\"></span>', ['value' => Url::to(['view-deduction']).'&id=' . (string)$model->_id, 'class' => 'btn btn-warning btn-view btn-responsive','id' => 'modalButton2']);\r\n                    } else {\r\n                        return Html::button('<span class=\"glyphicon glyphicon-eye-open\"></span>', ['value' => Url::to(['view-deduction']).'&id=' . (string)$model->_id, 'class' => 'btn btn-warning btn-view btn-responsive','id' => 'modalButton2'])\r\n                        .'&nbsp'\r\n                        . Html::button('<span class=\"glyphicon glyphicon-pencil\"></span>', ['value' => Url::to(['update-deduction']).'&id=' . (string)$model->_id, 'class' => 'btn btn-success btn-view btn-responsive','id' => 'modalButton3'])\r\n                        .'&nbsp'\r\n                        . Html::a('<span class=\"glyphicon glyphicon-remove\"></span>', ['delete-deduction', 'id' => (string)$model->_id], ['class' => 'btn btn-danger btn-responsive', 'data' => ['confirm' => 'Are you sure you want to delete this deduction item?', 'method' => 'post']])\r\n                        .'&nbsp'\r\n                        . Html::button('Unset as Default', ['value' => (string)$model->_id, 'class' => 'btn btn-danger btn-responsive', 'onclick'=>'unset(value)']);\r\n                        }\r\n                    } else {\r\n                         return Html::button('<span class=\"glyphicon glyphicon-eye-open\"></span>', ['value' => Url::to(['view-deduction']).'&id=' . (string)$model->_id, 'class' => 'btn btn-warning btn-view btn-responsive','id' => 'modalButton2'])\r\n                        .'&nbsp'\r\n                        . Html::button('<span class=\"glyphicon glyphicon-pencil\"></span>', ['value' => Url::to(['update-deduction']).'&id=' . (string)$model->_id, 'class' => 'btn btn-success btn-view btn-responsive','id' => 'modalButton3'])\r\n                        .'&nbsp'\r\n                        . Html::a('<span class=\"glyphicon glyphicon-remove\"></span>', ['delete-deduction', 'id' => (string)$model->_id], ['class' => 'btn btn-danger btn-responsive', 'data' => ['confirm' => 'Are you sure you want to delete this deduction item?', 'method' => 'post']])\r\n                        .'&nbsp'\r\n                        . Html::button('Set as Default', ['value' => (string)$model->_id, 'class' => 'btn btn-info btn-responsive', 'onclick'=>'set(value)']);\r\n                    }\r\n                }\r\n            ]\r\n        ],\r\n        'sortableAction' => Yii::$app->request->baseUrl . '/index.php?r=payroll-items/deduction-index'\r\n    ]); ?>\r\n````\r\n\r\nThe dragging works fine and all but in my view, I have \"Create Deduction Item\" button (located above the GridView) where it will show a modal for creation of a deduction item and whenever I click \"Save\", it will generate that error.\r\n\r\nThe widget didn't have enough info so I'm really having a hard time on what to do.\r\n\r\nI'm looking forward for your response and help."},"comment":{"url":"https://api.github.com/repos/himiklab/yii2-sortable-grid-view-widget/issues/comments/127648745","html_url":"https://github.com/himiklab/yii2-sortable-grid-view-widget/issues/15#issuecomment-127648745","issue_url":"https://api.github.com/repos/himiklab/yii2-sortable-grid-view-widget/issues/15","id":127648745,"user":{"login":"himiklab","id":6266409,"avatar_url":"https://avatars.githubusercontent.com/u/6266409?v=3","gravatar_id":"","url":"https://api.github.com/users/himiklab","html_url":"https://github.com/himiklab","followers_url":"https://api.github.com/users/himiklab/followers","following_url":"https://api.github.com/users/himiklab/following{/other_user}","gists_url":"https://api.github.com/users/himiklab/gists{/gist_id}","starred_url":"https://api.github.com/users/himiklab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/himiklab/subscriptions","organizations_url":"https://api.github.com/users/himiklab/orgs","repos_url":"https://api.github.com/users/himiklab/repos","events_url":"https://api.github.com/users/himiklab/events{/privacy}","received_events_url":"https://api.github.com/users/himiklab/received_events","type":"User","site_admin":false},"created_at":"2015-08-04T15:26:49Z","updated_at":"2015-08-04T15:26:49Z","body":"Add in your model:\r\n```\r\npublic static function tableName()\r\n{\r\n    return 'payroll_items';\r\n}\r\n```"}}