Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
148387 | Oct 17,2019 12:12 PM UTC | Oct 21,2019 02:51 AM UTC | ASP.NET MVC | 1 |
![]() |
Tags: Grid |
<script type="text/javascript">
$(function () {
$("#Grid").ejGrid({
// the datasource "window.gridData" is referred from jsondata.min.js
dataSource: window.gridData,
allowPaging: true,
allowGrouping: true,
allowRowDragAndDrop: true,
rowDrop: function (args) {
var dragRowIndex = args.rows[0].rowIndex; //get index of dragged row
var dropRowIndex = args.target.closest("tr")[0].rowIndex; //get index of dr row
var groupedColumns = this.model.groupSettings.groupedColumns; // grouped columnn
//var dataIndex =this.model.currentViewData.records.indexOf(args.data[0]);
// grouped column is shipCountry
// if you have multiple group columns , you need to loop thorugh it to get and set blow “value”
var value = this.model.currentViewData["records"][dropRowIndex]["ShipCountry"]; // get the value of group for the dropped row
this.model.currentViewData["records"][dragRowIndex ]["ShipCountry"] = value; //set that group value of the dragged row in the record list of currentViewData
this.refreshContent();
args.cancel = true;
},
groupSettings: { groupedColumns: ["ShipCountry"] },
columns: [
{ field: "OrderID", headerText: "Order ID", textAlign: ej.TextAlign.Right, width: 65 },
{ field: "CustomerID", headerText: "Customer ID", width: 90 },
{ field: "ShipCity", headerText: "Ship City", width: 90 },
{ field: "ShipCountry", headerText: "Ship Country", width: 90 },
{ field: "EmployeeID", headerText: "Employee ID", width: 90, textAlign: ej.TextAlign.Right }
]
});
});
</script>
|
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.