Skip to content

Commit 00c9d41

Browse files
committed
chore(sample): update dev sample (internal use only)
1 parent 20aaf88 commit 00c9d41

File tree

2 files changed

+129
-4
lines changed

2 files changed

+129
-4
lines changed

sample/src/samples/dev/basic-use.html

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77
v-row-height="25"
88
v-header-height="50"
99
v-multi-select="true"
10-
10+
v-only-custom="true"
1111
v-local-collection-event.delegate="collectionChange($event.detail)"
1212
v-current-entity.bind=myCurrentEntity
13-
13+
v-attribute-observe="name,index"
1414
v-collection.bind=myCollection
1515
v-grid-context.bind=myGrid>
16-
<v-grid-col col-width="80" col-type="text" col-field="index" col-sort="index" col-header-name="Record" col-filter="index|>" col-filter-top="true" col-add-row-attributes="v-row-menu='index' v-key-move" col-add-filter-attributes="v-col-header-name-menu='date'"></v-grid-col>
17-
<v-grid-col col-width="120" col-type="text" col-field="name" col-sort="name" col-header-name="Full name" col-filter="name|*|onKeyDown" col-filter-top="false" col-add-row-attributes="v-row-menu='name' v-key-move" col-add-filter-attributes="v-col-header-name-menu='name'"></v-grid-col>
16+
<v-grid-col col-width="80" col-type="text" col-field="index" col-sort="index" col-header-name="Record" col-filter="index|>" col-filter-top="true"></v-grid-col>
17+
<v-grid-col col-width="120" col-type="text" col-field="name" col-sort="name" col-header-name="Full name" col-filter="name|*|onKeyDown" col-filter-top="false"></v-grid-col>
1818
<v-grid-col col-width="100" col-field="number | numberFormat & updateTrigger:'blur':'paste'" col-sort="number" col-header-name="Salery" col-filter="number|>=" col-filter-top="true" col-add-row-attributes="v-row-menu='number' v-key-move" col-add-filter-attributes="v-col-header-name-menu='number'" col-css="color:${tempRef.numberColor};font-weight:${tempRef.numberFont}"></v-grid-col>
1919
<v-grid-col col-width="105" col-type="text" col-field="date | dateFormat & updateTrigger:'blur':'paste'" col-sort="date" col-header-name="Created" col-filter="date|>|dateFormat" col-filter-top="true" col-add-row-attributes="v-row-menu='date' v-key-move" col-add-filter-attributes="v-col-header-name-menu='date'"></v-grid-col>
2020
<v-grid-col col-width="100" col-type="checkbox" col-field="bool" col-sort="bool" col-header-name="Booked" col-filter="bool|=" col-filter-top="true" col-add-row-attributes="v-row-menu='bool' v-key-move" col-add-filter-attributes="v-col-header-name-menu='bool'"></v-grid-col>
@@ -27,6 +27,16 @@
2727
<button click.trigger="showSelectedBtn()">show selected</button>
2828
<button click.trigger="showAll()">show all</button>
2929
<button click.trigger="showOnlyNotSelected()">show not selected</button>
30+
<div class="col-md-6">
31+
<button click.delegate="setColumns()">set columns</button>
32+
<button click.delegate="setColumns2()">set columns2</button>
33+
</div>
34+
35+
36+
<div class="col-md-6">
37+
<button click.delegate="sort1()">sort1</button>
38+
<button click.delegate="sort2()">sort2</button>
39+
</div>
3040

3141
</div>
3242
</template>

sample/src/samples/dev/basic-use.js

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,120 @@ export class BasicUse {
4242
this.myGrid.ctx.showOnlyNotSelected();
4343
}
4444

45+
setColumns(){
46+
this.myGrid.ctx.setColumns(this.columnsOption1)
47+
this.myGrid.ctx.reGenerateColumns();
48+
}
49+
50+
51+
52+
setColumns2(){
53+
this.myGrid.ctx.setColumns(this.columnsOption2)
54+
this.myGrid.ctx.reGenerateColumns();
55+
}
56+
57+
58+
singleClick(e) {
59+
console.log("click")
60+
}
61+
62+
63+
singleDblClick(e) {
64+
console.log("dblClick")
65+
}
66+
67+
// sort1(){
68+
// let sortArray = [
69+
// {attribute:"name", asc:true},
70+
// {attribute:"number", asc:false}
71+
// ]
72+
//
73+
// this.myGrid.ctx.orderBy(sortArray);
74+
//
75+
// }
76+
77+
78+
sort1(){
79+
var columns = this.myGrid.ctx.getColumns();
80+
columns.pop();
81+
this.myGrid.ctx.setColumns(columns)
82+
this.myGrid.ctx.reGenerateColumns();
83+
84+
85+
86+
}
87+
88+
sort2(){
89+
let sortArray = [
90+
{attribute:"name", asc:false},
91+
{attribute:"number", asc:false}
92+
]
93+
94+
this.myGrid.ctx.orderBy(sortArray);
95+
96+
}
97+
98+
columnsOption1 = [
99+
{
100+
colWidth:122,
101+
colField:"name"
102+
},
103+
{
104+
colWidth:122,
105+
colField:"bool"
106+
},
107+
{
108+
colWidth:122,
109+
colField:"number"
110+
}]
111+
112+
113+
columnsOption2 = [
114+
{
115+
colWidth: 100,
116+
colRowTemplate: null,
117+
colHeaderTemplate: null,
118+
colField: "name",
119+
colHeaderName: "Full name",
120+
colAddLabelAttributes: "",
121+
colAddFilterAttributes: "",
122+
colAddRowAttributes: "",
123+
colSort: "name",
124+
colFilter: true,
125+
colFilterTop: false,
126+
colCss: "",
127+
colType: "text"
128+
},
129+
{
130+
colWidth: 100,
131+
colRowTemplate: null,
132+
colHeaderTemplate: null,
133+
colField: "bool",
134+
colHeaderName: "Bool value",
135+
colAddLabelAttributes: "",
136+
colAddFilterAttributes: "",
137+
colAddRowAttributes: "",
138+
colSort: null,
139+
colFilter: true,
140+
colFilterTop: false,
141+
colCss: "",
142+
colType: "checkbox"
143+
}, {
144+
colWidth: 100,
145+
colRowTemplate: null,
146+
colHeaderTemplate: null,
147+
colField: "number",
148+
colHeaderName: "Salery",
149+
colAddLabelAttributes: "",
150+
colAddFilterAttributes: "",
151+
colAddRowAttributes: "",
152+
colSort: null,
153+
colFilter: true,
154+
colFilterTop: false,
155+
colCss: "color:${tempRef.numberColor};font-weight:${tempRef.numberFont}",
156+
colType: "text"
157+
}]
158+
159+
45160

46161
}

0 commit comments

Comments
 (0)