Code:
var clientStore = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({
url: 'data.aspx'
}),
reader: new Ext.data.JsonReader({
root: 'rows', totalProperty: 'results', id: 'id',
fields: [
'id', 'logokey', 'opp_anal_qtr', 'opp_month', 'sbu_name', 'clientname', 'theatre', 'businessunit', 'channel', 'product', 'companytype', 'industry', 'service_center', 'batch_type', 'Opty_Size_Bucket', 'total_renewals_opp_c', 'total_renewals_opp_d', 'total_renewals_trans', 'house_acc_todate_c', 'house_acc_todate_d', 'net_opp_avail_c', 'net_opp_avail_d', 'acc_closed_early_c', 'opp_closed_early', 'acv_closed_early', 'transamt_closed_early', 'acc_closed_ontime_c', 'opp_closed_ontime', 'acv_closed_ontime', 'transamt_closed_ontime', 'acc_closed_late_c', 'opp_closed_late', 'acv_closed_late', 'transamt_closed_late', 'acc_closed_earlymonth_c', 'opp_closed_earlymonth', 'acv_closed_earlymonth', 'transamt_closed_earlymonth', 'acc_closed_ontimebymonth_c', 'opp_closed_ontimebymonth', 'acv_closed_ontimebymonth', 'transamt_closed_ontimebymonth', 'acc_closed_latemonth_c', 'opp_closed_latemonth', 'acv_closed_latemonth', 'transamt_closed_latemonth', 'acc_total_closedsale_c', 'opp_total_closedsale', 'acv_total_closedsale', 'transamt_total_closesale', 'acc_noservice_early_c', 'opp_noservice_early', 'acc_noservice_ontime_c', 'opp_noservice_ontime', 'acc_noservice_late_c', 'opp_noservice_late', 'acc_total_noservicetodate_c', 'opp_total_noservicetodate', 'acc_noservice_earlybymonth_c', 'opp_noservice_earlybymonth', 'acc_noservice_ontimemonth_c', 'opp_noservice_ontimemonth', 'acc_noservice_latebymonth_c', 'opp_noservice_latebymonth', 'acc_total_resolvetodate_c', 'opp_total_resolvetodate', 'acv_total_resolvetodate', 'trans_total_resolvetodate', 'amt_unresolv_remaining_c', 'amt_unresolve_remaining', 'contact_dia_c', 'contact_dia', 'quote_dia_c', 'quote_dia', 'closed_dia_c', 'closed_dia', 'sales_cycle_length_c', 'sales_cycle_length',
]
}),
baseParams: {
action: 'getQuant'
}
, remoteSort: true
});
//store.setDefaultSort('clientname', 'asc');
var cm = new Ext.grid.ColumnModel([{
header: "id",
width: 100,
//hidden: true,
dataIndex: 'id'
}, {
header: "Key",
width: 150,
sortable: true,
dataIndex: 'logokey'
}, {
header: "Opportunity Analysis Quarter",
width: 150,
sortable: true,
dataIndex: 'opp_anal_qtr'
}, {
header: "Opportunity Month",
width: 100,
sortable: true,
dataIndex: 'opp_month'
}, {
header: "SBU Name",
width: 100,
sortable: true,
dataIndex: 'sbu_name'
}, {
header: "Client Name",
width: 100,
sortable: true,
dataIndex: 'clientname'
}, {
header: "Theatre",
width: 100,
sortable: true,
dataIndex: 'theatre'
}, {
header: "Business Unit",
width: 100,
sortable: true,
dataIndex: 'businessunit'
}, {
header: "Channel",
width: 100,
sortable: true,
dataIndex: 'channel'
}, {
header: "Analysis SBU",
width: 100,
sortable: true,
dataIndex: 'analysis_sbu'
}, {
header: "Industry",
width: 100,
sortable: true,
dataIndex: 'industry'
}, {
header: "Product",
width: 100,
sortable: true,
dataIndex: 'product'
}, {
header: "Company Type",
width: 100,
sortable: true,
dataIndex: 'companytype'
}, {
header: "Product OEM/DVAR",
width: 150,
sortable: true,
dataIndex: 'product_oem_dvar'
}, {
header: "Analysis Industry Sector",
width: 150,
sortable: true,
dataIndex: 'anal_indus_sec'
}, {
header: "Analysis Group",
width: 100,
sortable: true,
dataIndex: 'anal_group'
}, {
header: "Service Center",
width: 100,
sortable: true,
dataIndex: 'service_center'
}, {
header: "Batch Type",
width: 100,
sortable: true,
dataIndex: 'batch_type'
}, {
header: "Opty_Size_Bucket",
width: 100,
sortable: true,
dataIndex: 'Opty_Size_Bucket'
}, {
header: "Count: Total Renewals Opty Expiring in the Qtr:",
width: 230,
sortable: true,
renderer: fmtnum,
dataIndex: 'total_renewals_opp_c'
}, {
header: "Total Renewals Opty Expiring in the Qtr:",
width: 220,
sortable: true,
renderer: usMoneyNoDecimal,
dataIndex: 'total_renewals_opp_d'
}, {
header: "Total Renewals Trans in the Qtr:",
width: 180,
sortable: true,
renderer: usMoneyNoDecimal,
dataIndex: 'total_renewals_trans'
}, {
header: "Count: House Accounted to Date:",
width: 180,
sortable: true,
renderer: fmtnum,
dataIndex: 'house_acc_todate_c'
}, {
header: "House Accounted to Date:",
width: 150,
sortable: true,
dataIndex: 'house_acc_todate_d'
}, {
header: "Count: Net Opportunity Available:",
width: 200,
sortable: true,
renderer: fmtnum,
dataIndex: 'net_opp_avail_c'
}, {
header: "Net Opportunity Available:",
width: 160,
sortable: true,
renderer: usMoneyNoDecimal,
dataIndex: 'net_opp_avail_d'
}, {
header: "Count: Closed Early (# of Accounts):",
width: 200,
sortable: true,
renderer: fmtnum,
dataIndex: 'acc_closed_early_c'
}, {
header: "Closed Early (Opportunity):",
width: 180,
sortable: true,
renderer: usMoneyNoDecimal,
dataIndex: 'opp_closed_early'
}, {
header: "Closed Early (ACV):",
width: 100,
sortable: true,
renderer: usMoneyNoDecimal,
dataIndex: 'acv_closed_early'
}, {
header: "Closed Early (Trans Amnt):",
width: 180,
sortable: true,
renderer: usMoneyNoDecimal,
dataIndex: 'transamt_closed_early'
}, {
header: "Count: Closed On Time (# of Accounts):",
width: 200,
sortable: true,
renderer: fmtnum,
dataIndex: 'acc_closed_ontime_c'
}, {
header: "Closed On Time (Opportunity):",
width: 180,
sortable: true,
renderer: usMoneyNoDecimal,
dataIndex: 'opp_closed_ontime'
}, {
header: "Closed On Time (ACV):",
width: 100,
renderer: usMoneyNoDecimal,
sortable: true,
dataIndex: 'acv_closed_ontime'
}, {
header: "Closed On Time (Trans Amnt):",
width: 150,
sortable: true,
renderer: usMoneyNoDecimal,
dataIndex: 'transamt_closed_ontime'
}, {
header: "Count: Closed Late (# of Accounts):",
width: 200,
sortable: true,
renderer: fmtnum,
dataIndex: 'acc_closed_late_c'
}, {
header: "Closed Late (Opportunity):",
width: 100,
sortable: true,
renderer: usMoneyNoDecimal,
dataIndex: 'opp_closed_late'
}, {
header: "Closed Late (ACV):",
width: 100,
sortable: true,
renderer: usMoneyNoDecimal,
dataIndex: 'acv_closed_late'
}, {
header: "Closed Late (Trans Amnt):",
width: 100,
sortable: true,
renderer: usMoneyNoDecimal,
dataIndex: 'transamt_closed_late'
}, {
header: "Count: Closed Early by Month (# of Accounts):",
width: 200,
sortable: true,
renderer: fmtnum,
dataIndex: 'acc_closed_earlymonth_c'
}, {
header: "Closed Early by Month (Opportunity):",
width: 150,
sortable: true,
renderer: usMoneyNoDecimal,
dataIndex: 'opp_closed_earlymonth'
}, {
header: "Closed Early by Month (ACV):",
width: 100,
sortable: true,
renderer: usMoneyNoDecimal,
dataIndex: 'acv_closed_earlymonth'
}, {
header: "Closed Early by Month (Trans Amnt):",
width: 100,
renderer: usMoneyNoDecimal,
sortable: true,
dataIndex: 'transamt_closed_earlymonth'
}, {
header: "Count: Closed On Time by Month (# of Accounts):",
width: 200,
sortable: false,
renderer: fmtnum,
dataIndex: 'acc_closed_ontimebymonth_c'
}, {
header: "Closed On Time by Month (Opportunity):",
width: 150,
sortable: false,
renderer: usMoneyNoDecimal,
dataIndex: 'opp_closed_ontimebymonth'
}, {
header: "Closed On Time by Month (ACV):",
width: 150,
sortable: false,
renderer: usMoneyNoDecimal,
dataIndex: 'acv_closed_ontimebymonth'
}, {
header: "Closed On Time by Month (Trans Amnt):",
width: 150,
sortable: false,
renderer: usMoneyNoDecimal,
dataIndex: 'transamt_closed_ontimebymonth'
}, {
header: "Count: Closed Late by Month (# of Account s):",
width: 150,
sortable: false,
renderer: fmtnum,
dataIndex: 'acc_closed_latemonth_c'
}, {
header: "Closed Late by Month (Opportunity):",
width: 150,
sortable: false,
renderer: usMoneyNoDecimal,
dataIndex: 'opp_closed_latemonth'
}, {
header: "Closed Late by Month (ACV):",
width: 150,
sortable: false,
renderer: usMoneyNoDecimal,
dataIndex: 'acv_closed_latemonth'
}, {
header: "Closed Late by Month (Trans Amnt):",
width: 150,
sortable: false,
renderer: usMoneyNoDecimal,
dataIndex: 'transamt_closed_latemonth'
}, {
header: "Count: Total Closed Sales to Date(# of Accounts):",
width: 150,
sortable: false,
renderer: fmtnum,
dataIndex: 'acc_total_closedsale_c'
}, {
header: "Total Closed Sales to Date (Opportunity):",
width: 150,
sortable: false,
renderer: usMoneyNoDecimal,
dataIndex: 'opp_total_closedsale'
}, {
header: "Total Closed Sales to Date (ACV):",
width: 50,
sortable: false,
renderer: usMoneyNoDecimal,
dataIndex: 'acv_total_closedsale'
}, {
header: "Total Closed Sales to Date (Trans Amnt):",
width: 150,
sortable: false,
renderer: usMoneyNoDecimal,
dataIndex: 'transamt_total_closesale'
}, {
header: "Count: No Service Early (# of Accounts):",
width: 150,
sortable: false,
renderer: fmtnum,
dataIndex: 'acc_noservice_early_c'
}, {
header: "No Service Early (Opportunity):",
width: 150,
sortable: false,
dataIndex: 'opp_noservice_early'
}, {
header: "Count: No Service On Time (# of Accounts):",
width: 150,
sortable: false,
renderer: fmtnum,
dataIndex: 'acc_noservice_ontime_c'
}, {
header: "No Service On Time (Opportunity):",
width: 150,
sortable: false,
renderer: usMoneyNoDecimal,
dataIndex: 'opp_noservice_ontime'
}, {
header: "Count: No Service Late (# of Accounts):",
width: 150,
sortable: false,
renderer: fmtnum,
dataIndex: 'acc_noservice_late_c'
}, {
header: "No Service Late (Opportunity):",
width: 150,
sortable: false,
renderer: usMoneyNoDecimal,
dataIndex: 'opp_noservice_late'
}, {
header: "Count: Total No Service to Date(# of Accounts):",
width: 150,
sortable: false,
renderer: fmtnum,
dataIndex: 'acc_total_noservicetodate_c'
}, {
header: "Total No Service to Date (Opportunity):",
width: 150,
sortable: false,
renderer: usMoneyNoDecimal,
dataIndex: 'opp_total_noservicetodate'
}, {
header: "Count: No Service Early by Month (# of Accounts):",
width: 150,
sortable: false,
renderer: fmtnum,
dataIndex: 'acc_noservice_earlybymonth_c'
}, {
header: "No Service Early by Month (Opportunity):",
width: 150,
sortable: false,
renderer: usMoneyNoDecimal,
dataIndex: 'opp_noservice_earlybymonth'
}, {
header: "Count: No Service On Time by Month (# of Accounts):",
width: 150,
sortable: false,
renderer: fmtnum,
dataIndex: 'acc_noservice_ontimemonth_c'
}, {
header: "No Service On Time by Month (Opportunity):",
width: 150,
sortable: false,
renderer: usMoneyNoDecimal,
dataIndex: 'opp_noservice_ontimemonth'
}, {
header: "Count: No Service Late by Month (# of Accounts):",
width: 150,
sortable: false,
renderer: fmtnum,
dataIndex: 'acc_noservice_latebymonth_c'
}, {
header: "No Service Late by Month (Opportunity):",
width: 150,
sortable: false,
renderer: usMoneyNoDecimal,
dataIndex: 'opp_noservice_latebymonth'
}, {
header: "Count: Total Resolved to Date(# of Accounts):",
width: 50,
sortable: false,
renderer: fmtnum,
dataIndex: 'acc_total_resolvetodate_c'
}, {
header: "Total Resolved to Date (Opportunity):",
width: 150,
sortable: false,
renderer: usMoneyNoDecimal,
dataIndex: 'opp_total_resolvetodate'
}, {
header: "Total Resolved to Date (ACV):",
width: 150,
sortable: false,
renderer: usMoneyNoDecimal,
dataIndex: 'acv_total_resolvetodate'
}, {
header: "Total Resolved to Date (Transaction):",
width: 150,
sortable: false,
renderer: usMoneyNoDecimal,
dataIndex: 'trans_total_resolvetodate'
}, {
header: "Count: Amount Unresolved Remaining:",
width: 150,
sortable: false,
renderer: fmtnum,
dataIndex: 'amt_unresolv_remaining_c'
}, {
header: "Amount Unresolved Remaining:",
width: 150,
sortable: false,
renderer: usMoneyNoDecimal,
dataIndex: 'amt_unresolve_remaining'
}, {
header: "Count: Contact DIA",
width: 100,
sortable: false,
renderer: fmtnum,
dataIndex: 'contact_dia_c'
}, {
header: "Contact DIA",
width: 50,
sortable: false,
dataIndex: 'contact_dia'
}, {
header: "Count: Quote DIA",
width: 100,
sortable: false,
renderer: fmtnum,
dataIndex: 'quote_dia_c'
}, {
header: "Quote DIA",
width: 50,
sortable: false,
dataIndex: 'quote_dia'
}, {
header: "Count: Closed DIA",
width: 100,
sortable: false,
renderer: fmtnum,
dataIndex: 'closed_dia_c'
}, {
header: "Closed DIA",
width: 50,
sortable: false,
dataIndex: 'closed_dia'
}, {
header: "Count: Deals Closed Before Exp",
width: 50,
sortable: false,
renderer: fmtnum,
dataIndex: 'deals_closed_beforeexp_c'
}, {
header: "Deals Closed Before Exp",
width: 150,
sortable: false,
dataIndex: 'deals_closed_beforeexp'
}, {
header: "Count: Sales Cycle Length",
width: 150,
sortable: false,
renderer: fmtnum,
dataIndex: 'sales_cycle_length_c'
}, {
header: "Sales Cycle Length",
width: 150,
sortable: false,
dataIndex: 'sales_cycle_length'
}, {
header: "Sort Order",
width: 50,
sortable: false,
dataIndex: 'sortorder'
}]);
cm.defaultSortable = true;
var toolbar = new Ext.PagingToolbar({
pageSize: 25,
store: clientStore,
displayInfo: true,
displayMsg: 'Displaying topics {0} - {1} of {2}',
emptyMsg: "No topics to display"
});
clntDataGrd = new Ext.grid.GridPanel({
title:'Client Data',
store: clientStore,
cm: cm,
trackMouseOver:false,
loadMask: true
, bbar: toolbar
, tbar: [{
xtype: 'tbtext',
text: 'Logo_ID:'
},{
id: 'clientLogo',
xtype: 'combo',
typeAhead: true,
//tpl: '<tpl for="."><div ext:qtip="{logoid}" class="x-combo-list-item">{logoid}</div></tpl>',
triggerAction: 'all',
width: 150,
editable: false,
mode: 'local',
displayField: 'logoid',
valueField: 'id',
lazyInit: false,
//store: prospectlogoStore,
store: clntLogoCombo,
listClass: 'x-combo-list-small'
},{
xtype: 'tbspacer'
} ,{
text: 'Refresh',
tooltip: 'Load Quant Client data',
iconCls: 'search',
handler: function() {
if (Ext.getCmp('clientLogo').getValue() == '' || Ext.getCmp('clientLogo').getValue() == null) {
Ext.Msg.alert('Status', 'Please select a Logo_ID');
return false;
}
loadClientData();
//loadSurvey('q');
}
}, {
xtype: 'tbfill'
}, {
id: 'btnImportClipBoardQuant',
xtype: 'tbbutton',
text: 'Import',
tooltip: 'Import Data from Clipboard',
iconCls: 'importicon',
handler: function() {
ImportClipBoardQuant("btnImportClipBoardQuant")
}
}]
});
//store.load({params:{start:0, limit:25}});
//clientStore.load({ params: { meta: true} });
function loadClientData() {
v = Ext.getCmp('clientLogo').getValue();
// clientStore.on('load', function() {
// clientStore.params = {
// id:v,
// start: 0, limit: 25
// };
// });
//clientStore.load({ params: { id: v} });
// clientStore.load({
// params: {
// id: v
// }
// })
var gridFoot = clntDataGrd.getBottomToolbar();
//numRows = parseInt(clntDataGrd.getStore().getCount())
clntDataGrd.getStore().reload({ params: { id: v , start: 0, limit: 25} });
var paging = new Ext.PagingToolbar(gridFoot, clientStore, {
pageSize: 25, //number of records displayed in grid
displayInfo: true, // change this to false, if you dont want info displayed
displayMsg: 'Displaying records {0} - {1} of {2}',
emptyMsg: "No records to display"
});
clntDataGrd.reconfigure(clientStore, clntDataGrd.getColumnModel());
//clntDataGrd.getStore().load({ params: { start: 0, limit: 25} });
}