ktoole
01-27-2010, 06:46 AM
I am having a problem getting the row-editor example from ExtJS's web site to work for the Valence data coming in. I have the data store loading correctly, I checked with Firebug, but the data does not display on the screen and I can't figure out why it won't. The code from their example does work, but when I change it to what I am working with it displays the headings for the data and loads the store correctly, but no data shows up on the screen. What did I miss? Here is the code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Copyright" content="Copyright 2008-2009 CNX Corporation, All Rights Reserved">
<title>Valence - AutoCode - Grid Inquiry Template</title>
<link rel="stylesheet" type="text/css" href="/extjs/resources/css/ext-all.css" />
<link rel="stylesheet" type="text/css" href="/extjs/resources/css/RowEditor.css" />
<link rel="stylesheet" type="text/css" href="/vvresources/valence.css" />
<script type="text/javascript" src="/extjs/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="/extjs/ext-all-debug.js"></script>
<script type="text/javascript" src="/lps/RowEditor.js"></script>
<script type="text/javascript" src="/vvresources/valence.js"></script>
<script type="text/javascript">
Ext.onReady(function(){
Ext.QuickTips.init();
var recordRef = Ext.data.Record.create(['LXCMP','LXGROUP','LXFILD','LXDESC','LXLEN','LXAN' ,'LXDEC','LXUINVT','LXSEQ','LXACTIVE','LXAREA',
'LXCCTD','LXCCTT','LXCCTU','LXLCGD','LXLCGT','LXLC GU']);
var dsReaderRef = new Ext.data.JsonReader({
root: "MLPXREF",
totalProperty: "totalCount"
}, recordRef);
var dsRef = new Ext.data.GroupingStore({
autoLoad: true,
url: 'vvcall.pgm',
reader: dsReaderRef,
remoteSort: true,
sortInfo: {
field: 'LXGROUP',
direction: 'ASC'
},
groupField: 'LXGROUP',
listeners:{
beforeload: function(){
this.baseParams = {
pgm: 'MLPXREF2',
action: 'getRecords'
}
}
}
});
var editor = new Ext.ux.grid.RowEditor({
saveText: 'Update'
});
var grid = new Ext.grid.GridPanel({
store: dsRef,
region:'center',
plugins: [editor],
view: new Ext.grid.GroupingView({
markDirty: false
}),
/* tbar: [{
iconCls: 'icon-user-add',
text: 'Add Record',
handler: function(){
var e = new Employee({
name: 'New Guy',
email: 'new@exttest.com',
start: (new Date()).clearTime(),
salary: 50000,
active: true
});
editor.stopEditing();
store.insert(0, e);
grid.getView().refresh();
grid.getSelectionModel().selectRow(0);
editor.startEditing(0);
}
},{
ref: '../removeBtn',
iconCls: 'icon-user-delete',
text: 'Remove Employee',
disabled: true,
handler: function(){
editor.stopEditing();
var s = grid.getSelectionModel().getSelections();
for(var i = 0, r; r = s[i]; i++){
store.remove(r);
}
}
}],
*/
columns: [
new Ext.grid.RowNumberer(),
{
xtype: 'numbercolumn',
header: 'Company No.',
dataIndex: 'LXCMP',
width: 100,
sortable: true,
format: '0',
editor: {
xtype: 'numberfield',
allowBlank: false,
minValue: 1,
maxValue: 99
}
},{
header: 'Data Group',
dataIndex: 'LXGROUP',
width: 150,
sortable: true,
editor: {
xtype: 'textfield',
allowBlank: false
}
},{
header: 'Data Field',
dataIndex: 'LXDESC',
width: 150,
sortable: true,
editor: {
xtype: 'textfield',
allowBlank: false
}
},{
xtype: 'numbercolumn',
header: 'Field Length',
dataIndex: 'LXLEN',
width: 100,
sortable: true,
editor: {
xtype: 'numberfield',
allowBlank: false,
minValue: 1,
maxValue: 999
}
},{
header: 'Field Type',
dataIndex: 'LXAN',
width: 150,
sortable: true,
editor: {
xtype:'textfield'
}
/* editor: {
xtype: 'combobox',
autoLoad: true,
triggerAction:'all',
forceSelection:true,
displayField:'text',
valueField:'type',
editable: false,
store: new Ext.data.SimpleStore({
fields: ['type', 'text'],
data: [['A', 'Alpha'], ['N', 'Numeric'], ['D', 'Date'], ['T', 'Time']]
}),
mode: 'local',
allowBlank: false
}
*/ },{
xtype: 'numbercolumn',
header: 'Decimal Positions',
dataIndex: 'LXDEC',
width: 100,
sortable: true,
editor: {
xtype: 'numberfield',
allowBlank: false,
minValue: 1,
maxValue: 9
}
},{
xtype: 'booleancolumn',
header: 'Update Inventory?',
dataIndex: 'LXUINVT',
align: 'center',
width: 50,
trueText: 'Y',
falseText: 'N',
editor: {
xtype: 'checkbox'
}
},{
xtype: 'numbercolumn',
header: 'Sequence Number',
dataIndex: 'LXSEQ',
width: 100,
sortable: true,
editor: {
xtype: 'numberfield',
allowBlank: false,
minValue: 1,
maxValue: 9999
}
},{
xtype: 'booleancolumn',
header: 'Active?',
dataIndex: 'LXACTIVE',
align: 'center',
width: 50,
trueText: 'Y',
falseText: 'N',
editor: {
xtype: 'checkbox'
}
},{
xtype: 'datecolumn',
header: 'Last Change Date',
dataIndex: 'LXCCTD',
format: 'm/d/Y',
width: 100,
sortable: true,
groupRenderer: Ext.util.Format.dateRenderer('M y'),
editable: false
},{
xtype: 'numbercolumn',
header: 'Last Change Time',
dataIndex: 'LXCCTT',
width: 100,
sortable: true,
editable: false
},{
header: 'Last Change User',
dataIndex: 'LXCCTU',
width: 100,
sortable: true,
editable: false
},{
xtype: 'datecolumn',
header: 'Last Change Date',
dataIndex: 'LXLCGD',
format: 'm/d/Y',
width: 100,
sortable: true,
groupRenderer: Ext.util.Format.dateRenderer('M y'),
editable: false
},{
xtype: 'numbercolumn',
header: 'Last Change Time',
dataIndex: 'LXLCGT',
width: 100,
sortable: true,
editable: false
},{
header: 'Last Change User',
dataIndex: 'LXLCGU',
width: 100,
sortable: true,
editable: false
}]
});
/* editor.on({
scope: this,
afteredit: function(grid, changes, record, rowIndex), {
Ext.Ajax.request({
url: vvcall.pgm,
params: {
action: 'updateRecord',
pgm: 'MLPXREF2',
success: function(response){
var check = response.responseText;
if (check){
var data = Ext.util.JSON.decode(response.responseText);
if (data.SUCCESS != '1')
Ext.Msg.alert('Record Not Found','Hmmm...could not retrieve the record');
Ext.getCmp('editWindow').hide();
};
}
Ext.getBody().unmask();
},
failure: function(){
Ext.getBody().unmask();
Ext.Msg.alert('Failure','Failed to receive a response from server');
}
});
})
}
})
*/
var layout = new Ext.Panel({
title: 'Data Setup File Data',
layout: 'border',
layoutConfig: {
columns: 1
},
width: 1600,
height: 600,
items: [grid]
});
layout.render(Ext.getBody());
grid.getSelectionModel().on('selectionchange', function(sm){
grid.removeBtn.setDisabled(sm.getCount() < 1);
});
});
</script>
</head>
<body>
</body>
</html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Copyright" content="Copyright 2008-2009 CNX Corporation, All Rights Reserved">
<title>Valence - AutoCode - Grid Inquiry Template</title>
<link rel="stylesheet" type="text/css" href="/extjs/resources/css/ext-all.css" />
<link rel="stylesheet" type="text/css" href="/extjs/resources/css/RowEditor.css" />
<link rel="stylesheet" type="text/css" href="/vvresources/valence.css" />
<script type="text/javascript" src="/extjs/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="/extjs/ext-all-debug.js"></script>
<script type="text/javascript" src="/lps/RowEditor.js"></script>
<script type="text/javascript" src="/vvresources/valence.js"></script>
<script type="text/javascript">
Ext.onReady(function(){
Ext.QuickTips.init();
var recordRef = Ext.data.Record.create(['LXCMP','LXGROUP','LXFILD','LXDESC','LXLEN','LXAN' ,'LXDEC','LXUINVT','LXSEQ','LXACTIVE','LXAREA',
'LXCCTD','LXCCTT','LXCCTU','LXLCGD','LXLCGT','LXLC GU']);
var dsReaderRef = new Ext.data.JsonReader({
root: "MLPXREF",
totalProperty: "totalCount"
}, recordRef);
var dsRef = new Ext.data.GroupingStore({
autoLoad: true,
url: 'vvcall.pgm',
reader: dsReaderRef,
remoteSort: true,
sortInfo: {
field: 'LXGROUP',
direction: 'ASC'
},
groupField: 'LXGROUP',
listeners:{
beforeload: function(){
this.baseParams = {
pgm: 'MLPXREF2',
action: 'getRecords'
}
}
}
});
var editor = new Ext.ux.grid.RowEditor({
saveText: 'Update'
});
var grid = new Ext.grid.GridPanel({
store: dsRef,
region:'center',
plugins: [editor],
view: new Ext.grid.GroupingView({
markDirty: false
}),
/* tbar: [{
iconCls: 'icon-user-add',
text: 'Add Record',
handler: function(){
var e = new Employee({
name: 'New Guy',
email: 'new@exttest.com',
start: (new Date()).clearTime(),
salary: 50000,
active: true
});
editor.stopEditing();
store.insert(0, e);
grid.getView().refresh();
grid.getSelectionModel().selectRow(0);
editor.startEditing(0);
}
},{
ref: '../removeBtn',
iconCls: 'icon-user-delete',
text: 'Remove Employee',
disabled: true,
handler: function(){
editor.stopEditing();
var s = grid.getSelectionModel().getSelections();
for(var i = 0, r; r = s[i]; i++){
store.remove(r);
}
}
}],
*/
columns: [
new Ext.grid.RowNumberer(),
{
xtype: 'numbercolumn',
header: 'Company No.',
dataIndex: 'LXCMP',
width: 100,
sortable: true,
format: '0',
editor: {
xtype: 'numberfield',
allowBlank: false,
minValue: 1,
maxValue: 99
}
},{
header: 'Data Group',
dataIndex: 'LXGROUP',
width: 150,
sortable: true,
editor: {
xtype: 'textfield',
allowBlank: false
}
},{
header: 'Data Field',
dataIndex: 'LXDESC',
width: 150,
sortable: true,
editor: {
xtype: 'textfield',
allowBlank: false
}
},{
xtype: 'numbercolumn',
header: 'Field Length',
dataIndex: 'LXLEN',
width: 100,
sortable: true,
editor: {
xtype: 'numberfield',
allowBlank: false,
minValue: 1,
maxValue: 999
}
},{
header: 'Field Type',
dataIndex: 'LXAN',
width: 150,
sortable: true,
editor: {
xtype:'textfield'
}
/* editor: {
xtype: 'combobox',
autoLoad: true,
triggerAction:'all',
forceSelection:true,
displayField:'text',
valueField:'type',
editable: false,
store: new Ext.data.SimpleStore({
fields: ['type', 'text'],
data: [['A', 'Alpha'], ['N', 'Numeric'], ['D', 'Date'], ['T', 'Time']]
}),
mode: 'local',
allowBlank: false
}
*/ },{
xtype: 'numbercolumn',
header: 'Decimal Positions',
dataIndex: 'LXDEC',
width: 100,
sortable: true,
editor: {
xtype: 'numberfield',
allowBlank: false,
minValue: 1,
maxValue: 9
}
},{
xtype: 'booleancolumn',
header: 'Update Inventory?',
dataIndex: 'LXUINVT',
align: 'center',
width: 50,
trueText: 'Y',
falseText: 'N',
editor: {
xtype: 'checkbox'
}
},{
xtype: 'numbercolumn',
header: 'Sequence Number',
dataIndex: 'LXSEQ',
width: 100,
sortable: true,
editor: {
xtype: 'numberfield',
allowBlank: false,
minValue: 1,
maxValue: 9999
}
},{
xtype: 'booleancolumn',
header: 'Active?',
dataIndex: 'LXACTIVE',
align: 'center',
width: 50,
trueText: 'Y',
falseText: 'N',
editor: {
xtype: 'checkbox'
}
},{
xtype: 'datecolumn',
header: 'Last Change Date',
dataIndex: 'LXCCTD',
format: 'm/d/Y',
width: 100,
sortable: true,
groupRenderer: Ext.util.Format.dateRenderer('M y'),
editable: false
},{
xtype: 'numbercolumn',
header: 'Last Change Time',
dataIndex: 'LXCCTT',
width: 100,
sortable: true,
editable: false
},{
header: 'Last Change User',
dataIndex: 'LXCCTU',
width: 100,
sortable: true,
editable: false
},{
xtype: 'datecolumn',
header: 'Last Change Date',
dataIndex: 'LXLCGD',
format: 'm/d/Y',
width: 100,
sortable: true,
groupRenderer: Ext.util.Format.dateRenderer('M y'),
editable: false
},{
xtype: 'numbercolumn',
header: 'Last Change Time',
dataIndex: 'LXLCGT',
width: 100,
sortable: true,
editable: false
},{
header: 'Last Change User',
dataIndex: 'LXLCGU',
width: 100,
sortable: true,
editable: false
}]
});
/* editor.on({
scope: this,
afteredit: function(grid, changes, record, rowIndex), {
Ext.Ajax.request({
url: vvcall.pgm,
params: {
action: 'updateRecord',
pgm: 'MLPXREF2',
success: function(response){
var check = response.responseText;
if (check){
var data = Ext.util.JSON.decode(response.responseText);
if (data.SUCCESS != '1')
Ext.Msg.alert('Record Not Found','Hmmm...could not retrieve the record');
Ext.getCmp('editWindow').hide();
};
}
Ext.getBody().unmask();
},
failure: function(){
Ext.getBody().unmask();
Ext.Msg.alert('Failure','Failed to receive a response from server');
}
});
})
}
})
*/
var layout = new Ext.Panel({
title: 'Data Setup File Data',
layout: 'border',
layoutConfig: {
columns: 1
},
width: 1600,
height: 600,
items: [grid]
});
layout.render(Ext.getBody());
grid.getSelectionModel().on('selectionchange', function(sm){
grid.removeBtn.setDisabled(sm.getCount() < 1);
});
});
</script>
</head>
<body>
</body>
</html>