siesta-lite
Version:
Stress-free JavaScript unit testing and functional testing tool, works in NodeJS and browsers
95 lines (80 loc) • 2.8 kB
HTML
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>The source code</title>
<link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="../resources/prettify/prettify.js"></script>
<style type="text/css">
.highlight { display: block; background-color: #ddd; }
</style>
<script type="text/javascript">
function highlight() {
document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
}
</script>
</head>
<body onload="prettyPrint(); highlight();">
<pre class="prettyprint lang-js">/*
Siesta 5.6.1
Copyright(c) 2009-2022 Bryntum AB
https://bryntum.com/contact
https://bryntum.com/products/siesta/license
*/
Ext.define('Siesta.Recorder.UI.ContextMenu', {
extend : 'Ext.menu.Menu',
alias : 'widget.recordercontextmenu',
panel : null,
width : 300,
plain : true,
initComponent : function () {
var me = this;
//var R = Siesta.Resource('Siesta.Recorder.UI.RecorderPanel');
Ext.apply(me, {
items : [
{
xtype : 'textfield',
itemId : 'newGroupName',
fieldLabel : 'Create group',
width : 80,
enableKeyEvents : true,
listeners : {
specialkey : this.onCreateGroupKeyUp,
scope : this
}
}
]
});
this.panel.on({
rowcontextmenu : this.onActivate,
scope : this
})
this.callParent(arguments)
this.nameField = this.down('#newGroupName');
},
onActivate : function (panel, record, node, rowIndex, e) {
this.showAt(e.getXY());
this.nameField.reset();
e.stopEvent();
},
onCreateGroupKeyUp : function(field, e) {
if (e.getKey() === e.ENTER) {
var name = this.nameField.getValue();
if (name){
var store = this.panel.getStore();
var selected = this.panel.getSelectionModel().getSelected().items;
var firstRow = Math.min.apply(Math, selected.map(function(rec) { return rec.data.index; }));
store.getRootNode().insertChild(firstRow, {
action : 'group',
value : name,
expanded : true,
children : selected
});
this.hide();
}
}
}
});
</pre>
</body>
</html>