1
This commit is contained in:
@@ -0,0 +1,112 @@
|
||||
<template>
|
||||
<div>
|
||||
<JqxGrid ref="myGrid"
|
||||
@groupexpand="myGridOnGroupExpand($event)" @groupcollapse="myGridOnGroupCollapse($event)"
|
||||
:width="getWidth" :height="280" :source="dataAdapter" :columns="columns"
|
||||
:groupable="true" :pageable="true" :groups="['City']">
|
||||
</JqxGrid>
|
||||
|
||||
<div style="margin-top: 30px">
|
||||
<div style="float: left; margin-left: 20px">
|
||||
<JqxButton @click="expandBtnOnClick()" :width="125" :height="25">Expand Group</JqxButton>
|
||||
<br />
|
||||
<JqxButton @click="collapseBtnOnClick()" :width="125" :height="25">Collapse Group</JqxButton>
|
||||
<br />
|
||||
<span style="margin-top: 10px">Group:</span>
|
||||
<JqxInput ref="myInput" style="margin-left: 10px; margin-top: 10px" :width="20" :value="1"></JqxInput>
|
||||
</div>
|
||||
<div style="float: left; margin-left: 20px">
|
||||
<JqxButton @click="expandAllBtnOnClick()" :width="125" :height="25">Expand All</JqxButton>
|
||||
<br />
|
||||
<JqxButton @click="collapseAllBtnOnClick()" :width="125" :height="25">Collapse All</JqxButton>
|
||||
<br />
|
||||
</div>
|
||||
<div style="float: left; margin-left: 20px">
|
||||
<div style="font-weight: bold">
|
||||
<span>Event Log:</span>
|
||||
</div>
|
||||
<div style="margin-top: 10px">
|
||||
<span>Expanded Group:</span>
|
||||
<span ref="expandedGroupLog"></span>
|
||||
</div>
|
||||
<div style="margin-top: 10px">
|
||||
<span>Collapsed Group:</span>
|
||||
<span ref="collapsedGroupLog"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import JqxGrid from "jqwidgets-scripts/jqwidgets-vue/vue_jqxgrid.vue";
|
||||
import JqxButton from "jqwidgets-scripts/jqwidgets-vue/vue_jqxbuttons.vue";
|
||||
import JqxInput from "jqwidgets-scripts/jqwidgets-vue/vue_jqxinput.vue";
|
||||
|
||||
export default {
|
||||
components: {
|
||||
JqxGrid,
|
||||
JqxButton,
|
||||
JqxInput
|
||||
},
|
||||
data: function () {
|
||||
return {
|
||||
getWidth: '90%',
|
||||
dataAdapter: new jqx.dataAdapter(this.source),
|
||||
columns: [
|
||||
{ text: 'Company Name', datafield: 'CompanyName', width: 250 },
|
||||
{ text: 'City', datafield: 'City', width: 120 },
|
||||
{ text: 'Country', datafield: 'Country' }
|
||||
]
|
||||
}
|
||||
},
|
||||
beforeCreate: function () {
|
||||
this.source = {
|
||||
datatype: 'xml',
|
||||
datafields: [
|
||||
{ name: 'CompanyName', map: 'm\\:properties>d\\:CompanyName', type: 'string' },
|
||||
{ name: 'ContactName', map: 'm\\:properties>d\\:ContactName', type: 'string' },
|
||||
{ name: 'ContactTitle', map: 'm\\:properties>d\\:ContactTitle', type: 'string' },
|
||||
{ name: 'City', map: 'm\\:properties>d\\:City', type: 'string' },
|
||||
{ name: 'PostalCode', map: 'm\\:properties>d\\:PostalCode', type: 'string' },
|
||||
{ name: 'Country', map: 'm\\:properties>d\\:Country', type: 'string' }
|
||||
],
|
||||
root: 'entry',
|
||||
record: 'content',
|
||||
id: 'm\\:properties>d\\:CustomerID',
|
||||
url: 'customers.xml'
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
expandBtnOnClick: function() {
|
||||
let groupnum = this.$refs.myInput.val();
|
||||
if (!isNaN(groupnum)) {
|
||||
this.$refs.myGrid.expandgroup(groupnum);
|
||||
}
|
||||
},
|
||||
collapseBtnOnClick: function() {
|
||||
let groupnum = this.$refs.myInput.val();
|
||||
if (!isNaN(groupnum)) {
|
||||
this.$refs.myGrid.collapsegroup(groupnum);
|
||||
}
|
||||
},
|
||||
expandAllBtnOnClick: function() {
|
||||
this.$refs.myGrid.expandallgroups();
|
||||
},
|
||||
collapseAllBtnOnClick: function() {
|
||||
this.$refs.myGrid.collapseallgroups();
|
||||
},
|
||||
myGridOnGroupExpand: function(event) {
|
||||
let args = event.args;
|
||||
this.$refs.expandedGroupLog.innerHTML = 'Group: ' + args.group + ', Level: ' + args.level;
|
||||
},
|
||||
myGridOnGroupCollapse: function (event) {
|
||||
let args = event.args;
|
||||
this.$refs.collapsedGroupLog.innerHTML = 'Group: ' + args.group + ', Level: ' + args.level
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
Reference in New Issue
Block a user