Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
148269 | Oct 12,2019 04:42 PM UTC | Oct 14,2019 08:56 AM UTC | Vue | 1 |
![]() |
Tags: Data Grid |
<ejs-grid ref="grid" :dataSource="data" :pageSettings="pageOption" :toolbar="toolbar" :editSettings="editSettings" :cellSave="cellSave" allowPaging="true">
<e-columns>
.
.
<e-column field="Required" headerText="Required" :validationRules="ReqValidationRules" width="100"></e-column>
<e-column field="Stock" :validationRules="StockValidationRules" headerText="Stock" width="100"></e-column>
</e-columns>
</ejs-grid>
<script>
export default {
data() {
return {
.
.
ReqValidationRules: {
required: true,
max: [
args => {
// Get the parent row element of cell
var rowEle = args.element.closest(".e-row");
// Get the stock cell value
var stockCol = rowEle.querySelector('[aria-colindex="5"]').innerHTML;
// Compares the Required and Stock cell values and returns the result
return stockCol.length != 0 ? parseInt(args["value"]) <= parseInt(stockCol) : true;
}, "Required must be lesser than stock"
]
},
StockValidationRules: {
required: true,
min: [
args => {
// Get the parent row element of cell
var rowEle = args.element.closest(".e-row");
// Get the required cell value
var ReqCol = rowEle.querySelector('[aria-colindex="4"]').innerHTML;
// Compares the Required and Stock cell values and returns the result
return ReqCol.length != 0 ? parseInt(args["value"]) >= parseInt(ReqCol) : true;
}, "Stock must be greater than required"
]
}
};
}
}
</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.