mass action index now totally dependent on datagrid's index property

This commit is contained in:
Prashant Singh 2019-07-14 14:30:44 +05:30
parent f8a4f1ba1c
commit d860466dfc
4 changed files with 12 additions and 16 deletions

View File

@ -13,9 +13,9 @@ use DB;
*/
class AttributeDataGrid extends DataGrid
{
protected $index = 'id'; //the column that needs to be treated as index column
protected $index = 'id'; // column that needs to be treated as index column
protected $sortOrder = 'desc'; //asc or desc
protected $sortOrder = 'desc'; // asc or desc
public function prepareQueryBuilder()
{
@ -147,6 +147,7 @@ class AttributeDataGrid extends DataGrid
'type' => 'delete',
'action' => route('admin.catalog.attributes.massdelete'),
'label' => 'Delete',
'index' => 'admin_name',
'method' => 'DELETE'
]);
}

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
{
"/js/ui.js": "/js/ui.js?id=db306414f79cac86f7a3",
"/js/ui.js": "/js/ui.js?id=a651d73740d3e8fb70aa",
"/css/ui.css": "/css/ui.css?id=c846938a649c221ac297"
}

View File

@ -339,10 +339,11 @@
this.formURL(this.columnOrAlias, this.stringCondition, this.stringValue, label)
} else if (this.type == 'number') {
indexConditions = true;
if (this.filterIndex == this.columnOrAlias && (this.numberValue == 0 || this.numberValue < 0)) {
indexConditions = false;
alert('{{__('ui::app.datagrid.zero-index')}}');
if (this.filterIndex == this.columnOrAlias && (this.numberValue == 0 || this.numberValue < 0)) {
indexConditions = false;
alert('{{__('ui::app.datagrid.zero-index')}}');
}
if(indexConditions)
@ -403,12 +404,6 @@
for(i in this.filters) {
if (this.filters[i].column == 'sort') {
this.currentSort = this.filters[i].val;
// if (this.currentSort = 'asc') {
// this.currentSortIcon = this.sortUpIcon;
// } else {
// this.currentSortIcon = this.sortDownIcon;
// }
}
}
},
@ -611,8 +606,8 @@
}
for(i = 0; i < moreSplitted.length; i++) {
col = moreSplitted[i][0].replace(']','').split('[')[0];
cond = moreSplitted[i][0].replace(']','').split('[')[1]
col = moreSplitted[i][0].replace(']', '').split('[')[0];
cond = moreSplitted[i][0].replace(']', '').split('[')[1]
val = moreSplitted[i][1];
label = 'cannotfindthislabel';
@ -690,7 +685,7 @@
i = 0;
for(currentId in this.gridCurrentData.data[currentData]) {
if (i==0)
this.dataIds.push(this.gridCurrentData.data[currentData][currentId]);
this.dataIds.push(this.gridCurrentData.data[currentData][this.filterIndex]);
i++;
}