ExtJS enables you allow your users to reorder grid columns using drag & drop. By combining this feature with Ext JS state management, you can let users customize the look of grids and preserve those settings on a going-forward basis. However, users occasionally make mistakes, so it’s helpful to also give them the option to restore the grid columns back to their initial defaults as illustrated by the following code snippet:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
| Ext.application({ name: 'Fiddle' , launch: function () { // tooltips are good! Ext.QuickTips.init(); // turn on state management - store state in cookies Ext.state.Manager.setProvider(Ext.create( 'Ext.state.CookieProvider' )); var store = Ext.create( 'Ext.data.Store' , { fields: [ 'first' , 'last' ], data: [{ first: 'Steve' , last: 'Drucker' }, { first: 'Dave' , last: 'Gallerizzo' }, { first: 'Jason' , last: 'Perry' }] }); Ext.widget( 'grid' , { renderTo: Ext.getBody(), store: store, title: 'Names' , stateful: true , // turn on state management for the grid stateId: 'gridexample' , // give the grid instance a unique state id width: 300, height: 200, columns: [{ text: 'First' , dataIndex: 'first' , flex: 1 }, { text: 'Last' , dataIndex: 'last' , flex: 1 }], tools: [{ type: 'gear' , tooltip: 'Reset Grid Layout' , handler: function (event, toolEl, owner, tool) { Ext.Msg.confirm( 'Reset Grid Layout' , 'Are you sure that you want to reset the grid layout?' , function (response) { if (response == 'yes' ) { var grid = tool.up( 'grid' ); // clear the state management for the grid Ext.state.Manager.clear(grid.stateId); // repaint the grid using the hardcoded defaults grid.reconfigure(grid.getStore(), grid.initialConfig.columns); } }); } } ] }); } }); |
Run the example at https://fiddle.sencha.com/#fiddle/3kq
racaZendzu Heather Wang https://wakelet.com/wake/rB0gd2C5psf8Ed5E6nUar
ReplyDeletefromiztralvi
dalcur0stin-ba_Omaha Shannon Baker Visit
ReplyDeleteBootstrap Studio
Kaspersky Total Security
bandmadmipha
WfremseWsubmu Joe Bonsness Software
ReplyDeleteClick here
icdedere