Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
148702 | Oct 30,2019 07:31 PM UTC | Nov 11,2019 12:47 PM UTC | React - EJ 2 | 7 |
![]() |
Tags: Grid |
// Function for updating the grid data
onUpdate() {
// Find the row index with the primary key value
var rowIndex = this.gridObj.getRowIndexByPrimaryKey(4);
// Get the current row data for the index and store it
var rowData = this.gridObj.currentViewData[rowIndex];
// Modify the column values in the stored row data
rowData.Name = 'NewName';
// Update the grid row with the updated row data
this.gridObj.updateRow(rowIndex, rowData);
} |
<GridComponent filterSettings={this.FilterOptions} allowFiltering={true} allowPaging={true} dataSource={this.datamanager} width='100%'>
<ColumnsDirective>
.
.
<ColumnDirective field='Precio' headerText='Precio' width='120' />
<ColumnDirective field='Quantita' headerText='Quantita' width='120' />
<ColumnDirective field='Discount' headerText='Discount' width='120' />
<ColumnDirective field='subtotal' headerText='subtotal' width='120' valueAccessor={this.valueAccess} />
</ColumnsDirective>
</GridComponent> |
<script>
// Value accessor function
valueAccess(field, data, column){
// Calculating the subtotal and returning it
var total = getValue('Precio', data) * getValue('Quantita', data);
var discountprice = total * (getValue('Discount', data)/100);
var subtotal = parseInt(total - discountprice);
return subtotal + '$';
}
</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.