Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
150064 | Dec 19,2019 07:02 AM UTC | Dec 20,2019 10:18 AM UTC | Vue | 1 |
![]() |
Tags: Data Grid |
<div id="app">
<ejs-dropdownlist
id="games"
:dataSource="sportsData"
:fields="localFields"
:placeholder="localWaterMark"
:popupHeight="height"
:width="width"
:change="change"
></ejs-dropdownlist>
<ejs-grid ref="gridObj" :dataSource="data" height="300px" allowPaging="true" :load="GridLoad">
. . . .
</ejs-grid>
</div>
export default {
data() {
return {
formatoptions: { type: "dateTime", format: "M/d/y hh:mm:ss ss" },
data: orderDetails.slice(0),
sportsData: [
{ username: "Admin" },
{ username: "User" },
],
localFields: { text: "username", value: "username" },
localWaterMark: "Select a user",
height: "200px",
width: "300px"
};
},
methods: {
change(args) {
var gridProps = JSON.parse(window.localStorage.getItem("defaultGrid")); //Fetch the default Grid properties.
var parseGridProps;
switch (args.value) {
// Bind Grid properties through the setProperties based on username
case "Admin":
var props = { allowGrouping: true, allowFiltering: true };
parseGridProps = Object.assign(gridProps, props);
break;
case "User1":
var props = { allowGrouping: false, allowFiltering: false };
parseGridProps = Object.assign(gridProps, props);
break;
case "User2":
var props = { allowGrouping: true };
parseGridProps = Object.assign(gridProps, props);
break;
}
this.$refs.gridObj.$el.ej2_instances[0].setProperties(parseGridProps);
},
GridLoad() {
window.localStorage.setItem(
"defaultGrid",
this.$refs.gridObj.$el.ej2_instances[0].getPersistData() // Store the default Grid in local storage
);
|
dataBound: function (args) {
var cloned = (grid as any).addOnPersist;
(grid as any).addOnPersist = function (key) {
key = key.filter(item=> item !=="columns")
return cloned.call(this,key);
};
console.log("gridDataBound", args)
},
|
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.