Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pve-manager
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
pve-manager
Commits
d42c3158
Commit
d42c3158
authored
Jul 03, 2015
by
Dietmar Maurer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
copy form/ComboGrid.js from manager to manager5
parent
9b4c6b96
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
139 additions
and
0 deletions
+139
-0
ComboGrid.js
www/manager5/form/ComboGrid.js
+139
-0
No files found.
www/manager5/form/ComboGrid.js
0 → 100644
View file @
d42c3158
Ext
.
define
(
'
PVE.form.ComboGrid
'
,
{
extend
:
'
Ext.form.field.ComboBox
'
,
alias
:
[
'
widget.PVE.form.ComboGrid
'
],
// this value is used as default value after load()
preferredValue
:
undefined
,
computeHeight
:
function
()
{
var
me
=
this
;
var
lh
=
PVE
.
Utils
.
gridLineHeigh
();
var
count
=
me
.
store
.
getTotalCount
();
return
(
count
>
10
)
?
10
*
lh
:
26
+
count
*
lh
;
},
// hack: allow to select empty value
// seems extjs does not allow that when 'editable == false'
onKeyUp
:
function
(
e
,
t
)
{
var
me
=
this
;
var
key
=
e
.
getKey
();
if
(
!
me
.
editable
&&
me
.
allowBlank
&&
!
me
.
multiSelect
&&
(
key
==
e
.
BACKSPACE
||
key
==
e
.
DELETE
))
{
me
.
setValue
(
''
);
}
me
.
callParent
(
arguments
);
},
// copied from ComboBox
createPicker
:
function
()
{
var
me
=
this
,
picker
,
menuCls
=
Ext
.
baseCSSPrefix
+
'
menu
'
,
opts
=
Ext
.
apply
({
selModel
:
{
mode
:
me
.
multiSelect
?
'
SIMPLE
'
:
'
SINGLE
'
},
floating
:
true
,
hidden
:
true
,
ownerCt
:
me
.
ownerCt
,
cls
:
me
.
el
.
up
(
'
.
'
+
menuCls
)
?
menuCls
:
''
,
store
:
me
.
store
,
displayField
:
me
.
displayField
,
focusOnToFront
:
false
,
height
:
me
.
computeHeight
(),
pageSize
:
me
.
pageSize
},
me
.
listConfig
,
me
.
defaultListConfig
);
// NOTE: we simply use a grid panel
//picker = me.picker = Ext.create('Ext.view.BoundList', opts);
picker
=
me
.
picker
=
Ext
.
create
(
'
Ext.grid.Panel
'
,
opts
);
// pass getNode() to the view
picker
.
getNode
=
function
()
{
picker
.
getView
().
getNode
(
arguments
);
};
me
.
mon
(
picker
,
{
itemclick
:
me
.
onItemClick
,
refresh
:
me
.
onListRefresh
,
show
:
function
()
{
picker
.
setHeight
(
me
.
computeHeight
());
me
.
syncSelection
();
},
scope
:
me
});
me
.
mon
(
picker
.
getSelectionModel
(),
'
selectionchange
'
,
me
.
onListSelectionChange
,
me
);
return
picker
;
},
initComponent
:
function
()
{
var
me
=
this
;
if
(
me
.
initialConfig
.
editable
===
undefined
)
{
me
.
editable
=
false
;
}
Ext
.
apply
(
me
,
{
queryMode
:
'
local
'
,
matchFieldWidth
:
false
});
Ext
.
applyIf
(
me
,
{
value
:
''
});
// hack: avoid ExtJS validate() bug
Ext
.
applyIf
(
me
.
listConfig
,
{
width
:
400
});
me
.
callParent
();
me
.
store
.
on
(
'
beforeload
'
,
function
()
{
if
(
!
me
.
isDisabled
())
{
me
.
setDisabled
(
true
);
me
.
enableAfterLoad
=
true
;
}
});
// hack: autoSelect does not work
me
.
store
.
on
(
'
load
'
,
function
(
store
,
r
,
success
,
o
)
{
if
(
success
)
{
me
.
clearInvalid
();
if
(
me
.
enableAfterLoad
)
{
delete
me
.
enableAfterLoad
;
me
.
setDisabled
(
false
);
}
var
def
=
me
.
getValue
()
||
me
.
preferredValue
;
if
(
def
)
{
me
.
setValue
(
def
,
true
);
// sync with grid
}
var
found
=
false
;
if
(
def
)
{
if
(
Ext
.
isArray
(
def
))
{
Ext
.
Array
.
each
(
def
,
function
(
v
)
{
if
(
store
.
findRecord
(
me
.
valueField
,
v
))
{
found
=
true
;
return
false
;
// break
}
});
}
else
{
found
=
store
.
findRecord
(
me
.
valueField
,
def
);
}
}
if
(
!
found
)
{
var
rec
=
me
.
store
.
first
();
if
(
me
.
autoSelect
&&
rec
&&
rec
.
data
)
{
def
=
rec
.
data
[
me
.
valueField
];
me
.
setValue
(
def
,
true
);
}
else
{
me
.
setValue
(
me
.
editable
?
def
:
''
,
true
);
}
}
}
});
}
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment