First create solution
This commit is contained in:
@@ -0,0 +1,142 @@
|
||||
Nuvolar_Scanner_Android.StoragePDACollectionEdit = function (params) {
|
||||
|
||||
var viewModel = {
|
||||
viewShown: function (e) {
|
||||
//alert(params.id);
|
||||
|
||||
$("#gridContainer").dxDataGrid({
|
||||
dataSource: dataSourcePDARows,
|
||||
allowColumnReordering: true,
|
||||
allowColumnResizing: true,
|
||||
showColumnLines: true,
|
||||
showRowLines: true,
|
||||
rowAlternationEnabled: true,
|
||||
columnAutoWidth: true,
|
||||
height:450,
|
||||
columnChooser: {
|
||||
enabled: false
|
||||
},
|
||||
//paging: {
|
||||
// pageSize: 10
|
||||
//},
|
||||
scrolling: {
|
||||
mode: 'infinite'
|
||||
},
|
||||
//pager: {
|
||||
// showPageSizeSelector: true,
|
||||
// allowedPageSizes: [5, 10, 20]
|
||||
//},
|
||||
columnFixing: {
|
||||
enabled: true
|
||||
},
|
||||
selection: {
|
||||
mode: 'multiple',
|
||||
allowSelectAll: false
|
||||
},
|
||||
//editing: {
|
||||
// //editEnabled: true,
|
||||
// editMode: 'row',
|
||||
// //insertEnabled: true,
|
||||
// removeEnabled: true
|
||||
//},
|
||||
store: {key: "Oid"},
|
||||
onRowRemoving: function(e) {
|
||||
var dataGrid = $('#gridContainer').dxDataGrid('instance');
|
||||
|
||||
alert(dataGrid.getSelectedRowsData());
|
||||
e.cancel = true;
|
||||
//e.data.RecordStatus = 'Deleted';
|
||||
//var rowIndex = e.component.getRowIndexByKey(e.key);
|
||||
//var $commandEditCell = e.component.getCellElement(rowIndex, "command:edit");
|
||||
//$commandEditCell.empty();
|
||||
//$commandEditCell.parent().addClass("deleted");
|
||||
},
|
||||
columns: [{ dataField: "Oid",
|
||||
visible: false,
|
||||
key:true},
|
||||
{ dataField: "QTT",caption:'M.',dataType:'number' },
|
||||
{ dataField: "ShortName", caption:'Megnevezés'},
|
||||
{ dataField: "Barcode", caption: 'Vonalkód' },
|
||||
{
|
||||
dataField: "RowIndex", caption: 'S.',
|
||||
allowSorting: true,
|
||||
sortIndex: 1,
|
||||
sortOrder: 'desc',
|
||||
dataType: 'number'
|
||||
}
|
||||
]
|
||||
});
|
||||
SimpleQuery.UserName = username();
|
||||
SimpleQuery.Password = password();
|
||||
SimpleQuery.Database = database();
|
||||
dataSourcePDARows = null;
|
||||
$("#gridContainer").dxDataGrid({ dataSource: dataSourcePDARows })
|
||||
SimpleQuery.Query = 'DX_GetStoragePDACollectionRows_dxDataGrid;' + params.id;
|
||||
JSON_Text = JSON.stringify(SimpleQuery, null);
|
||||
$.getJSON(URL(), 'id='+JSON_Text, function (results) {
|
||||
dataSourcePDARows = JSON.parse(JSON.parse(results).Result);
|
||||
$("#gridContainer").dxDataGrid({dataSource: dataSourcePDARows})
|
||||
}
|
||||
).done(function () {
|
||||
//alert("second success");
|
||||
}).fail(function (jqXHR, textStatus, errorThrown) {
|
||||
DevExpress.ui.notify("Kapcsolati hiba, próbálja meg újra!", "error", 2000);
|
||||
});
|
||||
|
||||
},
|
||||
onEnterKeyBarcode: function (e) {
|
||||
SimpleQuery.UserName = username();
|
||||
SimpleQuery.Password = password();
|
||||
SimpleQuery.Database = database();
|
||||
SimpleQuery.Query = 'DX_InsertStoragePDACollectionRows_dxDataGrid;' + Barcode() + ';' + params.id+';'+QTT();
|
||||
JSON_Text = JSON.stringify(SimpleQuery, null);
|
||||
|
||||
$.getJSON(URL(), 'id=' + JSON_Text, function (results) {
|
||||
Barcode("");
|
||||
dataSourcePDARows = JSON.parse(JSON.parse(results).Result);
|
||||
$("#gridContainer").dxDataGrid({ dataSource: dataSourcePDARows })
|
||||
$("#BarcodeText").dxTextBox("instance").focus();
|
||||
}
|
||||
).done(function () {
|
||||
//alert("second success");
|
||||
}).fail(function (jqXHR, textStatus, errorThrown) {
|
||||
DevExpress.ui.notify("Kapcsolati hiba, próbálja meg újra!", "error", 2000);
|
||||
});
|
||||
//DevExpress.ui.notify("Enterkey fired", "success", 2000);
|
||||
//$.getJSON(URL(), null, function (results) {
|
||||
// //simpleProducts = JSON.parse(results).dataResult;
|
||||
// //alert(results);
|
||||
// simpleProducts = JSON.parse(results);
|
||||
// var productsWidget = $("#products-simple").dxSelectBox({
|
||||
// items: simpleProducts
|
||||
// }).dxSelectBox("instance");
|
||||
//}
|
||||
//).fail(function (jqXHR, textStatus, errorThrown) {
|
||||
// alert('getJSON request failed! ' + textStatus);
|
||||
//});
|
||||
},
|
||||
removerows: function (e) {
|
||||
var dataGrid = $('#gridContainer').dxDataGrid('instance');
|
||||
var items = dataGrid.getSelectedRowsData();
|
||||
for (i = 0; i < items.length; i++) {
|
||||
SimpleQuery.UserName = username();
|
||||
SimpleQuery.Password = password();
|
||||
SimpleQuery.Database = database();
|
||||
SimpleQuery.Query = 'DX_DeleteStoragePDACollectionRows_dxDataGrid;' + items[i].Oid;
|
||||
JSON_Text = JSON.stringify(SimpleQuery, null);
|
||||
|
||||
$.getJSON(URL(), 'id=' + JSON_Text, function (results) {
|
||||
dataSourcePDARows = JSON.parse(JSON.parse(results).Result);
|
||||
$("#gridContainer").dxDataGrid({ dataSource: dataSourcePDARows })
|
||||
}
|
||||
).done(function () {
|
||||
//alert("second success");
|
||||
}).fail(function (jqXHR, textStatus, errorThrown) {
|
||||
DevExpress.ui.notify("Kapcsolati hiba, próbálja meg újra!", "error", 2000);
|
||||
});
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
return viewModel;
|
||||
};
|
||||
Reference in New Issue
Block a user