Code:
function get_url_filterdata(){
}
function dateFormatRenderer(value) {
if (typeof value == 'string'){
return value;
}else{
return value ? Ext.Date.dateFormat(value, 'd/m/Y') : '';
}
}
function build_task_contributor_grid(pId) {
//Ext.onReady(function () {
console.log('Define Model '+Date());
// Define our data model
Ext.define('TASK_CONTRIBUTOR', {
extend : 'Ext.data.Model',
fields : ['CONTRIBUTOR_ID','TASK_ID','SERVICE_ID','CONTEXT','CONTEXT_ID','CONTEXT_X_ID','START_DATE','END_DATE','ROLE','MD5']
});
console.log('Define Store '+Date());
//Define the data store
TaskContributorStore = Ext.create('Ext.data.Store', {
// destroy the store if the grid is destroyed
autoDestroy : false,
model : 'TASK_CONTRIBUTOR',
remoteSort : true,
pageSize : 10,
storeid : 'TASK_CONTRIBUTOR',
proxy : {
type : 'ajax',
url : get_url_filterdata,
extraParams : {
x01 : 'TASK_CONTRIBUTOR',
x05 : 'TASK_ID = ' + pId
},
pageParam : undefined,
startParam : 'x02',
limitParam : 'x03',
filterParam : 'x04',
noCache : false,
reader : {
type : 'json',
root : 'ROWSET',
totalProperty : 'totalcount'
}
}
});
console.log('Define Grid Edit '+Date());
Ext.define('GridRowEditing', {
extend: 'Ext.grid.plugin.RowEditing',
alias: ['plugin.GridRowEditing'],
requires: [
'Ext.grid.RowEditor'
],
clicksToMoveEditor : 1,
autoCancel : false,
listeners : {
'edit' : function (editor, e) {
var grid = e.grid;
var record = e.record;
var statusMsg = 'Status';
//e.grid.store.storeid holds the context name!
gMsg = update_record(e.grid.store.storeid, record.data);
gMsg = jQuery.parseJSON(gMsg);
//set back record the MD5 as this would have changed during the update
for(i=0; i<gMsg.length; i++)
{
//e.record.set(gMsg[i].ITEM_NAME, gMsg[i].ITEM_MSG);
if(gMsg[i].ITEM_NAME == 'MD5')
{
e.record.set(gMsg[i].ITEM_NAME, gMsg[i].ITEM_MSG);
}
if(gMsg[i].ITEM_NAME == 'CVW_PAGE_LEVEL')
{
statusMsg = gMsg[i].ITEM_MSG;
}
}
Ext.MessageBox.alert('Status', statusMsg);//gMsg[0].ITEM_MSG);
e.record.commit();
}
}
});
// Define the Grid Editor
var TaskContributorrowEditing = Ext.create('GridRowEditing');
console.log('Build Grid 1 '+Date());
//create the grid and specify what fields we want
var TaskContributor1 = Ext.create('Ext.grid.Panel', {
store : TaskContributorStore,
autoDestroy : false,
minHeight : 300,
width : 600,
title : 'Task Contributors',
frame : true,
columns : [{
header: 'CONTRIBUTOR_ID',
dataIndex: 'CONTRIBUTOR_ID',
flex: 1,
hidden: true
},{
header: 'TASK_ID',
dataIndex: 'TASK_ID',
flex: 1,
hidden: true
},{
header: 'SERVICE_ID',
dataIndex: 'SERVICE_ID',
flex: 1,
hidden: true
},{
header: 'CONTEXT',
dataIndex: 'CONTEXT',
flex: 1,
hidden: true
},{
header: 'CONTEXT_ID',
dataIndex: 'CONTEXT_ID',
flex: 1,
hidden: true
},{
header: 'CONTEXT_X_ID',
dataIndex: 'CONTEXT_X_ID',
flex: 1,
hidden: true
},{
header : 'Start Date',
dataIndex : 'START_DATE',
width : 90,
minValue : '01/01/2001',
format : 'd/m/Y',
renderer : dateFormatRenderer,
field : {
xtype : 'datefield',
allowBlank : false,
format : 'd/m/Y',
minValue : '01/01/2001',
minText : 'Start date cannot be before today!',
maxValue : Ext.Date.format(new Date(), 'd/m/Y')
}
},{
header : 'End Date',
dataIndex : 'END_DATE',
width : 90,
minValue : '01/01/2001',
format : 'd/m/Y',
renderer : dateFormatRenderer,
field : {
xtype : 'datefield',
format : 'd/m/Y',
minValue : '01/01/2001',
minText : 'Start date cannot be before today!'
}
},{
header: 'Role',
dataIndex: 'ROLE',
flex: 1,
editor: {
id : 'editROLE',
xtype : 'textfield',
maxLength : 8,
allowBlank : false
}
},{
header: 'MD5',
dataIndex: 'MD5',
flex: 1,
hidden: true
}],
renderTo : 'TASK_CONTRIBUTOR-grid',
dockedItems : [{
dock : 'top',
xtype : 'toolbar',
items : [{
width : 200,
fieldLabel : 'Search',
labelWidth : 50,
xtype : 'searchfield',
store : TaskContributorStore
}, '->', {
xtype : 'component',
itemId : 'status',
tpl : 'Matching threads: {count}',
style : 'margin-right:5px'
}
]
}
],
tbar : [{
text : 'Add Task Contributor Details',
iconCls : 'TASK_CONTRIBUTOR-add',
handler : function () {
TaskContributorrowEditing.cancelEdit();
// Create a record instance through the ModelManager
var r = Ext.ModelManager.create({
CONTRIBUTOR_ID : ''
,TASK_ID : ''
,SERVICE_ID : ''
,CONTEXT : ''
,CONTEXT_ID : ''
,CONTEXT_X_ID : ''
,START_DATE : ''
,END_DATE : ''
,ROLE : ''
,MD5 : ''
}
, 'TASK_CONTRIBUTOR');
TaskContributorStore.insert(0, r);
TaskContributorrowEditing.startEdit(0, 0);
}
}, {
itemId : 'removeTASK_CONTRIBUTOR',
text : 'Remove Task Contributor',
iconCls : 'TASK_CONTRIBUTOR-remove',
handler : function () {
var sm = grid.getSelectionModel();
var rec = grid.getSelectionModel().getSelection();
//call the delete record function
//delete_record('TASK_CONTRIBUTOR',rec[0].data);
TaskProgressrowEditing.cancelEdit();
TaskProgressStore.remove(sm.getSelection());
sm.select(0);
},
disabled : true
}
],
plugins : [TaskContributorrowEditing],
bbar : Ext.create('Ext.PagingToolbar', {
store : TaskContributorStore,
displayInfo : true,
displayMsg : 'Displaying <b>{0} - {1} of {2}</b>',
emptyMsg : "No Task Contributors to display"
}),
listeners : {
'selectionchange' : function (view, records) {
grid.down('#removeTASK_CONTRIBUTOR').setDisabled(!records.length);
}
}
});
//TaskContributorStore.loadPage(1);
console.log('Build Grid 2 '+Date());
var TaskContributor2 = Ext.create('Ext.grid.Panel', {
store : TaskContributorStore,
autoDestroy : false,
minHeight : 300,
width : 600,
title : 'Task Contributors',
frame : true,
columns : [{
header: 'CONTRIBUTOR_ID',
dataIndex: 'CONTRIBUTOR_ID',
flex: 1,
hidden: true
},{
header: 'TASK_ID',
dataIndex: 'TASK_ID',
flex: 1,
hidden: true
},{
header: 'SERVICE_ID',
dataIndex: 'SERVICE_ID',
flex: 1,
hidden: true
},{
header: 'CONTEXT',
dataIndex: 'CONTEXT',
flex: 1,
hidden: true
},{
header: 'CONTEXT_ID',
dataIndex: 'CONTEXT_ID',
flex: 1,
hidden: true
},{
header: 'CONTEXT_X_ID',
dataIndex: 'CONTEXT_X_ID',
flex: 1,
hidden: true
},{
header : 'Start Date',
dataIndex : 'START_DATE',
width : 90,
minValue : '01/01/2001',
format : 'd/m/Y',
renderer : dateFormatRenderer,
field : {
xtype : 'datefield',
allowBlank : false,
format : 'd/m/Y',
minValue : '01/01/2001',
minText : 'Start date cannot be before today!',
maxValue : Ext.Date.format(new Date(), 'd/m/Y')
}
},{
header : 'End Date',
dataIndex : 'END_DATE',
width : 90,
minValue : '01/01/2001',
format : 'd/m/Y',
renderer : dateFormatRenderer,
field : {
xtype : 'datefield',
format : 'd/m/Y',
minValue : '01/01/2001',
minText : 'Start date cannot be before today!'
}
},{
header: 'Role',
dataIndex: 'ROLE',
flex: 1,
editor: {
id : 'editROLE',
xtype : 'textfield',
maxLength : 8,
allowBlank : false
}
},{
header: 'MD5',
dataIndex: 'MD5',
flex: 1,
hidden: true
}],
renderTo : 'TASK_CONTRIBUTOR-grid',
dockedItems : [{
dock : 'top',
xtype : 'toolbar',
items : [{
width : 200,
fieldLabel : 'Search',
labelWidth : 50,
xtype : 'searchfield',
store : TaskContributorStore
}, '->', {
xtype : 'component',
itemId : 'status',
tpl : 'Matching threads: {count}',
style : 'margin-right:5px'
}
]
}
],
tbar : [{
text : 'Add Task Contributor Details',
iconCls : 'TASK_CONTRIBUTOR-add',
handler : function () {
TaskContributorrowEditing.cancelEdit();
// Create a record instance through the ModelManager
var r = Ext.ModelManager.create({
CONTRIBUTOR_ID : ''
,TASK_ID : ''
,SERVICE_ID : ''
,CONTEXT : ''
,CONTEXT_ID : ''
,CONTEXT_X_ID : ''
,START_DATE : ''
,END_DATE : ''
,ROLE : ''
,MD5 : ''
}
, 'TASK_CONTRIBUTOR');
TaskContributorStore.insert(0, r);
TaskContributorrowEditing.startEdit(0, 0);
}
}, {
itemId : 'removeTASK_CONTRIBUTOR',
text : 'Remove Task Contributor',
iconCls : 'TASK_CONTRIBUTOR-remove',
handler : function () {
var sm = grid.getSelectionModel();
var rec = grid.getSelectionModel().getSelection();
//call the delete record function
//delete_record('TASK_CONTRIBUTOR',rec[0].data);
TaskProgressrowEditing.cancelEdit();
TaskProgressStore.remove(sm.getSelection());
sm.select(0);
},
disabled : true
}
],
plugins : [TaskContributorrowEditing],
bbar : Ext.create('Ext.PagingToolbar', {
store : TaskContributorStore,
displayInfo : true,
displayMsg : 'Displaying <b>{0} - {1} of {2}</b>',
emptyMsg : "No Task Contributors to display"
}),
listeners : {
'selectionchange' : function (view, records) {
grid.down('#removeTASK_CONTRIBUTOR').setDisabled(!records.length);
}
}
});
console.log('Build Grid 3 '+Date());
var TaskContributor3 = Ext.create('Ext.grid.Panel', {
store : TaskContributorStore,
autoDestroy : false,
minHeight : 300,
width : 600,
title : 'Task Contributors',
frame : true,
columns : [{
header: 'CONTRIBUTOR_ID',
dataIndex: 'CONTRIBUTOR_ID',
flex: 1,
hidden: true
},{
header: 'TASK_ID',
dataIndex: 'TASK_ID',
flex: 1,
hidden: true
},{
header: 'SERVICE_ID',
dataIndex: 'SERVICE_ID',
flex: 1,
hidden: true
},{
header: 'CONTEXT',
dataIndex: 'CONTEXT',
flex: 1,
hidden: true
},{
header: 'CONTEXT_ID',
dataIndex: 'CONTEXT_ID',
flex: 1,
hidden: true
},{
header: 'CONTEXT_X_ID',
dataIndex: 'CONTEXT_X_ID',
flex: 1,
hidden: true
},{
header : 'Start Date',
dataIndex : 'START_DATE',
width : 90,
minValue : '01/01/2001',
format : 'd/m/Y',
renderer : dateFormatRenderer,
field : {
xtype : 'datefield',
allowBlank : false,
format : 'd/m/Y',
minValue : '01/01/2001',
minText : 'Start date cannot be before today!',
maxValue : Ext.Date.format(new Date(), 'd/m/Y')
}
},{
header : 'End Date',
dataIndex : 'END_DATE',
width : 90,
minValue : '01/01/2001',
format : 'd/m/Y',
renderer : dateFormatRenderer,
field : {
xtype : 'datefield',
format : 'd/m/Y',
minValue : '01/01/2001',
minText : 'Start date cannot be before today!'
}
},{
header: 'Role',
dataIndex: 'ROLE',
flex: 1,
editor: {
id : 'editROLE',
xtype : 'textfield',
maxLength : 8,
allowBlank : false
}
},{
header: 'MD5',
dataIndex: 'MD5',
flex: 1,
hidden: true
}],
renderTo : 'TASK_CONTRIBUTOR-grid',
dockedItems : [{
dock : 'top',
xtype : 'toolbar',
items : [{
width : 200,
fieldLabel : 'Search',
labelWidth : 50,
xtype : 'searchfield',
store : TaskContributorStore
}, '->', {
xtype : 'component',
itemId : 'status',
tpl : 'Matching threads: {count}',
style : 'margin-right:5px'
}
]
}
],
tbar : [{
text : 'Add Task Contributor Details',
iconCls : 'TASK_CONTRIBUTOR-add',
handler : function () {
TaskContributorrowEditing.cancelEdit();
// Create a record instance through the ModelManager
var r = Ext.ModelManager.create({
CONTRIBUTOR_ID : ''
,TASK_ID : ''
,SERVICE_ID : ''
,CONTEXT : ''
,CONTEXT_ID : ''
,CONTEXT_X_ID : ''
,START_DATE : ''
,END_DATE : ''
,ROLE : ''
,MD5 : ''
}
, 'TASK_CONTRIBUTOR');
TaskContributorStore.insert(0, r);
TaskContributorrowEditing.startEdit(0, 0);
}
}, {
itemId : 'removeTASK_CONTRIBUTOR',
text : 'Remove Task Contributor',
iconCls : 'TASK_CONTRIBUTOR-remove',
handler : function () {
var sm = grid.getSelectionModel();
var rec = grid.getSelectionModel().getSelection();
//call the delete record function
//delete_record('TASK_CONTRIBUTOR',rec[0].data);
TaskProgressrowEditing.cancelEdit();
TaskProgressStore.remove(sm.getSelection());
sm.select(0);
},
disabled : true
}
],
plugins : [TaskContributorrowEditing],
bbar : Ext.create('Ext.PagingToolbar', {
store : TaskContributorStore,
displayInfo : true,
displayMsg : 'Displaying <b>{0} - {1} of {2}</b>',
emptyMsg : "No Task Contributors to display"
}),
listeners : {
'selectionchange' : function (view, records) {
grid.down('#removeTASK_CONTRIBUTOR').setDisabled(!records.length);
}
}
});
console.log('Build Grid 4 '+Date());
var TaskContributor4 = Ext.create('Ext.grid.Panel', {
store : TaskContributorStore,
autoDestroy : false,
minHeight : 300,
width : 600,
title : 'Task Contributors',
frame : true,
columns : [{
header: 'CONTRIBUTOR_ID',
dataIndex: 'CONTRIBUTOR_ID',
flex: 1,
hidden: true
},{
header: 'TASK_ID',
dataIndex: 'TASK_ID',
flex: 1,
hidden: true
},{
header: 'SERVICE_ID',
dataIndex: 'SERVICE_ID',
flex: 1,
hidden: true
},{
header: 'CONTEXT',
dataIndex: 'CONTEXT',
flex: 1,
hidden: true
},{
header: 'CONTEXT_ID',
dataIndex: 'CONTEXT_ID',
flex: 1,
hidden: true
},{
header: 'CONTEXT_X_ID',
dataIndex: 'CONTEXT_X_ID',
flex: 1,
hidden: true
},{
header : 'Start Date',
dataIndex : 'START_DATE',
width : 90,
minValue : '01/01/2001',
format : 'd/m/Y',
renderer : dateFormatRenderer,
field : {
xtype : 'datefield',
allowBlank : false,
format : 'd/m/Y',
minValue : '01/01/2001',
minText : 'Start date cannot be before today!',
maxValue : Ext.Date.format(new Date(), 'd/m/Y')
}
},{
header : 'End Date',
dataIndex : 'END_DATE',
width : 90,
minValue : '01/01/2001',
format : 'd/m/Y',
renderer : dateFormatRenderer,
field : {
xtype : 'datefield',
format : 'd/m/Y',
minValue : '01/01/2001',
minText : 'Start date cannot be before today!'
}
},{
header: 'Role',
dataIndex: 'ROLE',
flex: 1,
editor: {
id : 'editROLE',
xtype : 'textfield',
maxLength : 8,
allowBlank : false
}
},{
header: 'MD5',
dataIndex: 'MD5',
flex: 1,
hidden: true
}],
renderTo : 'TASK_CONTRIBUTOR-grid',
dockedItems : [{
dock : 'top',
xtype : 'toolbar',
items : [{
width : 200,
fieldLabel : 'Search',
labelWidth : 50,
xtype : 'searchfield',
store : TaskContributorStore
}, '->', {
xtype : 'component',
itemId : 'status',
tpl : 'Matching threads: {count}',
style : 'margin-right:5px'
}
]
}
],
tbar : [{
text : 'Add Task Contributor Details',
iconCls : 'TASK_CONTRIBUTOR-add',
handler : function () {
TaskContributorrowEditing.cancelEdit();
// Create a record instance through the ModelManager
var r = Ext.ModelManager.create({
CONTRIBUTOR_ID : ''
,TASK_ID : ''
,SERVICE_ID : ''
,CONTEXT : ''
,CONTEXT_ID : ''
,CONTEXT_X_ID : ''
,START_DATE : ''
,END_DATE : ''
,ROLE : ''
,MD5 : ''
}
, 'TASK_CONTRIBUTOR');
TaskContributorStore.insert(0, r);
TaskContributorrowEditing.startEdit(0, 0);
}
}, {
itemId : 'removeTASK_CONTRIBUTOR',
text : 'Remove Task Contributor',
iconCls : 'TASK_CONTRIBUTOR-remove',
handler : function () {
var sm = grid.getSelectionModel();
var rec = grid.getSelectionModel().getSelection();
//call the delete record function
//delete_record('TASK_CONTRIBUTOR',rec[0].data);
TaskProgressrowEditing.cancelEdit();
TaskProgressStore.remove(sm.getSelection());
sm.select(0);
},
disabled : true
}
],
plugins : [TaskContributorrowEditing],
bbar : Ext.create('Ext.PagingToolbar', {
store : TaskContributorStore,
displayInfo : true,
displayMsg : 'Displaying <b>{0} - {1} of {2}</b>',
emptyMsg : "No Task Contributors to display"
}),
listeners : {
'selectionchange' : function (view, records) {
grid.down('#removeTASK_CONTRIBUTOR').setDisabled(!records.length);
}
}
});
//});
}
Response Times