-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathListBox.js
More file actions
69 lines (58 loc) · 1.7 KB
/
ListBox.js
File metadata and controls
69 lines (58 loc) · 1.7 KB
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
Ext.define('Ext.ux.listbox.ListBox' ,{
extend : 'Ext.view.View',
requires : [
//'TT.view.content.constr.Selecter',
//'Ext.toolbar.Toolbar',
//'Ext.button.Button',
],
selectCls : Ext.baseCSSPrefix+'listbox-item-selected',
alias : 'widget.listbox',
cls : Ext.baseCSSPrefix+'listbox',
columningStyle: 'columns: {0}px; -moz-columns: {0}px; -webkit-columns: {0}px;',
columnWidth: 0,
multiSelect: true,
emptyText: 'No data',
prefix: '',
postfix: '',
displayField: 'title',
cntTag: 'div',
listTag: 'ul',
itemTag: 'li',
deletable: false,
autoScroll: true,
delBtnCls: Ext.baseCSSPrefix+'listbox-item-del',
initComponent: function() {
var me = this, tag = '<'+me.listTag;
me.itemSelector = me.itemTag+'.listbox-item';
if (!me.panel) {
me.cls += ' '+Ext.baseCSSPrefix+'listbox-bordered';
}
me.autoEl = { tag: me.cntTag, cls: me.cls };
if (me.columnWidth) {
tag += ' style="' + Ext.String.format(me.columningStyle, me.columnWidth) + '"';
}
tag += '>';
if (me.deletable) {
me.postfix += '<div class="'+me.delBtnCls+'">x</div>';
}
me.tpl = [
tag,
'<tpl for=".">',
'<',me.itemTag,' class="listbox-item">',
me.prefix,
'{',me.displayField,'}',
me.postfix,
'</',me.itemTag,'>',
'</tpl>',
'</',me.listTag,'>'
];
me.callParent(arguments);
me.on('beforeitemclick', me._onBeforeItemClick);
},
_onBeforeItemClick: function(me, rec, item, i, e) {
if (e && e.getTarget(0, 0, true).hasCls(me.delBtnCls)) {
rec.store.remove(rec);
return false;
}
}
});