Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
w2pext
plugin_dbui
Commits
7cf29a4e
Commit
7cf29a4e
authored
Sep 01, 2016
by
LE GAC Renaud
Browse files
Add the base class Dbui.grid.plugin.ContextMenu.
parent
1286792a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
123 additions
and
114 deletions
+123
-114
static/plugin_dbui/CHANGELOG
static/plugin_dbui/CHANGELOG
+6
-5
static/plugin_dbui/src/grid/plugin/ContextMenu.js
static/plugin_dbui/src/grid/plugin/ContextMenu.js
+109
-0
static/plugin_dbui/src/grid/plugin/RowEditorContextMenu.js
static/plugin_dbui/src/grid/plugin/RowEditorContextMenu.js
+8
-109
No files found.
static/plugin_dbui/CHANGELOG
View file @
7cf29a4e
--------------------------------- CHANGE LOG ----------------------------------
HEAD
- Add the base class Dbui.grid.plugin.ContextMenu
0.9.1 (Aug 2016)
- Migrate to Ext JS 6.0.1.250
- Migrate to the new build system build-version6 in w2pext/utilities.
0.9.0 (Jun 2016)
- Change the name space for the JavaScript code from App to Dbui.
- Fix the latex conversion for special character.
0.8.3 (Jun 2016)
- Migrate to web2py 2.14.6 and pyDAL 16.03.
- Release requires web2py 2.14 or higher due to changes in pyDAL.
- Update build_version to run third party tools via a docker container.
0.8.2 (Feb 2016)
- Add missing files in the compressed version of the ace plugin.
- Minor modification to run the application via a docker image.
...
...
@@ -25,12 +26,12 @@ HEAD
- Relase non backward compatible. Signatures of methods have changed:
App.buildDBURI, App.save, App.saveAs. In addition the download of pdf and
png files required a base64 String encoding on the server side.
0.7.2 - 0.7.3 (Nov - Dec 2015)
- Improve code compliance with pylint and jslint.
- build_version can generate small size version of the plugin files.
- Add the helper function inline_alert.
- Display the versions of the matplotlib and pandas libraries
- Display the versions of the matplotlib and pandas libraries
- List widget follows the allowBlank construct.
- Fix a bug in ComboBoxSlave.onMasterChange.
...
...
static/plugin_dbui/src/grid/plugin/ContextMenu.js
0 → 100644
View file @
7cf29a4e
/**
* The plugin instantiating the base class for context menu.
*
* Display the context menu when the user right click on a row.
*
* @since 0.9.2
*
*/
Ext
.
define
(
'
Dbui.grid.plugin.ContextMenu
'
,
{
extend
:
'
Ext.AbstractPlugin
'
,
alias
:
'
plugin.pGridContextMenu
'
,
uses
:
[
'
Ext.menu.Menu
'
],
/**
* @cfg {String} menu
* The configuration of the Ext.menu.Menu to be displayed
*
*/
menu
:
undefined
,
/**
* Initialize the plugin.
*
* @param {Dbui.grid.Panel} grid
*/
init
:
function
(
grid
)
{
"
use strict
"
;
var
me
=
this
;
me
.
setCmp
(
grid
);
me
.
menu
=
Ext
.
create
(
'
Ext.menu.Menu
'
,
me
.
menu
);
grid
.
on
({
'
containercontextmenu
'
:
me
.
onContainerContextMenu
,
'
headercontextmenu
'
:
me
.
onHeaderContextMenu
,
'
itemcontextmenu
'
:
me
.
onItemContextMenu
,
scope
:
me
});
},
/**
* Destroy the plugin.
*/
destroy
:
function
()
{
"
use strict
"
;
var
me
=
this
,
grid
=
me
.
getCmp
();
grid
.
un
(
'
containercontextmenu
'
,
me
.
onContainerContextMenu
,
me
);
grid
.
un
(
'
headercontextmenu
'
,
me
.
onHeaderContextMenu
,
me
);
grid
.
un
(
'
itemcontextmenu
'
,
me
.
onItemContextMenu
,
me
);
Ext
.
destroyMembers
(
me
,
'
menu
'
);
},
/**
* Show the context menu when right clicking in an empty grid.
*
* @param {Dbui.grid.Panel} grid
* @param {Ext.EventObject} event
*
*/
onContainerContextMenu
:
function
(
grid
,
event
)
{
"
use strict
"
;
var
me
=
this
;
event
.
stopEvent
();
me
.
getCmp
().
getSelectionModel
().
deselectAll
();
me
.
menu
.
showAt
(
event
.
getXY
());
},
/**
* Inhibit the context menu when right clicking in the grid header.
*
* @param {Ext.grid.header.Container} gridheader
* @param {Ext.grid.column.Column} column
* @param {Ext.EventObject} event
*
*/
onHeaderContextMenu
:
function
(
gridheader
,
colum
,
event
)
{
"
use strict
"
;
event
.
stopEvent
();
},
/**
* Show the context menu when right clicking in the non-empty grid.
*
* @param {Ext.view.View} view
* @param {Ext.data.Model} record
* @param {HTMLElement} item
* @param {Ext.EventObject} event
*
*/
onItemContextMenu
:
function
(
view
,
record
,
item
,
index
,
event
)
{
"
use strict
"
;
var
me
=
this
;
event
.
stopEvent
();
me
.
menu
.
showAt
(
event
.
getXY
());
}
});
\ No newline at end of file
static/plugin_dbui/src/grid/plugin/RowEditorContextMenu.js
View file @
7cf29a4e
...
...
@@ -9,12 +9,8 @@
*/
Ext
.
define
(
'
Dbui.grid.plugin.RowEditorContextMenu
'
,
{
extend
:
'
Ext.AbstractPlugin
'
,
extend
:
'
Dbui.grid.plugin.ContextMenu
'
,
alias
:
'
plugin.pGridRowEditorContextMenu
'
,
uses
:
[
'
Ext.menu.Menu
'
],
// private short cut
menu
:
null
,
// private properties for internationalization
textAdd
:
'
Add
'
,
...
...
@@ -24,6 +20,8 @@ Ext.define('Dbui.grid.plugin.RowEditorContextMenu', {
textUpdate
:
'
Update
'
,
textView
:
'
View
'
,
// jshint strict: false
/**
* Initialize the plugin.
*
...
...
@@ -31,19 +29,15 @@ Ext.define('Dbui.grid.plugin.RowEditorContextMenu', {
*/
init
:
function
(
grid
)
{
"
use strict
"
;
var
me
=
this
,
rowEditor
=
grid
.
getPlugin
(
'
rowEditor
'
);
me
.
setCmp
(
grid
);
// protection
if
(
!
rowEditor
)
{
throw
new
Error
(
'
no grid row editor !!!
'
);
}
me
.
menu
=
Ext
.
create
(
'
Ext.menu.Menu
'
,
{
me
.
menu
=
{
items
:
[{
text
:
me
.
textAdd
,
iconCls
:
'
xaction-create
'
,
...
...
@@ -70,105 +64,10 @@ Ext.define('Dbui.grid.plugin.RowEditorContextMenu', {
handler
:
rowEditor
.
onDeleteRow
,
scope
:
rowEditor
}]
});
grid
.
on
({
'
containercontextmenu
'
:
me
.
onContainerContextMenu
,
'
headercontextmenu
'
:
me
.
onHeaderContextMenu
,
'
itemcontextmenu
'
:
me
.
onItemContextMenu
,
scope
:
me
});
},
/**
* Destroy the plugin.
*/
destroy
:
function
()
{
"
use strict
"
;
var
me
=
this
,
grid
=
me
.
getCmp
();
grid
.
un
(
'
containercontextmenu
'
,
me
.
onContainerContextMenu
,
me
);
grid
.
un
(
'
headercontextmenu
'
,
me
.
onHeaderContextMenu
,
me
);
grid
.
un
(
'
itemcontextmenu
'
,
me
.
onItemContextMenu
,
me
);
Ext
.
destroyMembers
(
me
,
'
menu
'
);
},
/**
* Show the context menu when right clicking in an empty grid.
*
* @param {Dbui.grid.Panel} grid
* @param {Ext.EventObject} event
*
*/
onContainerContextMenu
:
function
(
grid
,
event
)
{
"
use strict
"
;
var
me
=
this
;
event
.
stopEvent
();
me
.
protectBufferedStore
();
me
.
getCmp
().
getSelectionModel
().
deselectAll
();
me
.
menu
.
showAt
(
event
.
getXY
());
},
};
/**
* Inhibit the context menu when right clicking in the grid header.
*
* @param {Ext.grid.header.Container} gridheader
* @param {Ext.grid.column.Column} column
* @param {Ext.EventObject} event
*
*/
onHeaderContextMenu
:
function
(
gridheader
,
colum
,
event
)
{
"
use strict
"
;
event
.
stopEvent
();
},
/**
* Show the context menu when right clicking in the non-empty grid.
*
* @param {Ext.view.View} view
* @param {Ext.data.Model} record
* @param {HTMLElement} item
* @param {Ext.EventObject} event
*
*/
onItemContextMenu
:
function
(
view
,
record
,
item
,
index
,
event
)
{
"
use strict
"
;
var
me
=
this
;
event
.
stopEvent
();
me
.
protectBufferedStore
();
me
.
menu
.
showAt
(
event
.
getXY
());
},
// private method to protected buffered store.
// NOTE: in ExtJS 4.2.1 the editor operations crashed with a buffered store
protectBufferedStore
:
function
()
{
"
use strict
"
;
var
me
=
this
,
i
,
items
,
store
=
me
.
getCmp
().
getStore
();
if
(
store
.
buffered
&&
Ext
.
getVersion
(
'
extjs
'
).
version
===
'
4.2.1.883
'
)
{
items
=
me
.
menu
.
query
(
'
menuitem
'
);
for
(
i
=
0
;
i
<
items
.
length
;
i
+=
1
)
{
// separate menuitem from menuseparator
if
(
items
[
i
].
getXType
()
===
'
menuitem
'
)
{
items
[
i
].
setDisabled
(
true
);
}
}
}
// initialise the base class
me
.
callParent
(
arguments
);
}
// jshint strict: true
});
\ No newline at end of file
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