franklt69
2 Feb 2007, 7:30 AM
Hi I have a page where I have a Grid it appear right (Page1), in the toolbar of grid, I add a button to show a layoutdialog, inside the layoutdialog I have other grid, if I set comment in the gridSearchCondition.render(); the grid in page1 appear right but if I remove the comments then some datas in the column of grid in Page1 dissapear, what is wrong?
this grid is in Page1
var XmlExample = function(){
return {
init : function(){
// limit selection in the grid to one row
// start initializing grid
sm = new YAHOO.ext.grid.SingleSelectionModel();
// listen for selection changes
sm.addListener('selectionchange', this.onSelection);
var colModel = new YAHOO.ext.grid.DefaultColumnModel([
{header: "ExternalId", width: 120, sortable: false},
{header: "Name", width: 120, sortable: true, locked: true},
{header: "Address", width: 180, sortable: true},
{header: "City", width: 115, sortable: true},
{header: "State", width: 100, sortable: true},
{header: "Zip", width: 80, sortable: true},
{header: "Phone", width: 100, sortable: true},
{header: "Fax", width: 100, sortable: true},
{header: "Mobil", width: 115, sortable: true},
{header: "Email", width: 200, sortable: true}
]);
//colModel.defaultSortable = true;
dataModel = new YAHOO.ext.grid.XMLDataModel({
tagName: 'Rows',
totalTag: 'TotalCount',
id: 'ExternalId',
fields: ['ExternalId', 'Name', 'Address', 'City', 'State', 'Zip', 'Phone', 'Fax', 'Mobil', 'Email']
});
dataModel.addListener('load', sm.selectFirstRow, sm, true);
// initialize paging
dataModel.initPaging('HandlerContact.ashx', 10);
dataModel.baseParams['value'] = value;
dataModel.baseParams['typeSearch'] = typeSearch;
dataModel.baseParams['operator'] = operator;
dataModel.baseParams['attribute'] = attribute;
dataModel.baseParams['condition'] = condition;
dataModel.setDefaultSort(colModel, 1, 'ASC');
// create the Grid
grid = new YAHOO.ext.grid.Grid('example-grid', dataModel, colModel, sm);
grid.render();
// the grid is ready, load page 1 of topics
var toolbar = grid.getView().getPageToolbar();
toolbar.addSeparator();
//toolbar.addButton({ className: 'new-topic-button', text: "New Topic", onNew.createDelegate(this)});
//toolbar.addButton({id:'btnDelete', text: '', className: 'navDelete', tooltip: 'Delete Current Record', click: this.showAddFeed.createDelegate(this)});
toolbar.addButton({id:'btnNew', text: '', className: 'navNew', tooltip: 'New Contact', click: this.onNew.createDelegate(this)});
toolbar.addButton({id:'btnEdit', text: '', className: 'navEdit', tooltip: 'Edit Current Record', click: this.onEdit.createDelegate(this)});
toolbar.addButton({id:'btnDelete', text: '', className: 'navDelete', tooltip: 'Delete Current Record', click: this.onDelete.createDelegate(this)});
toolbar.addSeparator();
toolbar.addButton({id:'btnFind', text: 'Find', className: 'doFind', tooltip: 'Find Contacts', click: this.onClickShowFindDlg.createDelegate(this)});
dataModel.loadPage(1);
grid.getColumnModel().setHidden(0, true);
grid.addListener('rowdblclick', this.onCelldblClick, this, true);
grid.addListener('cellclick', this.onCellClick, this, true);
},
onClickShowFindDlg : function(){
Search.init();
},
onSelection : function(){
selectRowId = grid.getSelectedRowId();
currentRowIndex = grid.getSelectedRowIndex();
}
} //end init
}();
YAHOO.ext.EventManager.onDocumentReady(XmlExample.init, XmlExample, true);
the js in the layout:
var Search = function(){
var findDlg;
return {
init : function(){
YAHOO.ext.state.Manager.setProvider(new YAHOO.ext.state.CookieProvider());
if(!findDlg){ // lazy initialize the findDlg and only create it once
findDlg = new YAHOO.ext.LayoutDialog("findDlg", {
modal:true,
width:650,
height:300,
shadow:true,
minWidth:300,
minHeight:300,
syncHeightBeforeShow: true,
fixedcenter: true,
center: {
titlebar: false,
autoScroll:true,
tabPosition: 'top',
closeOnTab: false,
alwaysShowTabs: false,
resizeTabs: true
},
south: {
split:true,
initialSize: 150,
minSize: 150,
maxSize: 200,
titlebar: true,
collapsible: true,
title: 'Find & Save Conditions',
animate: true
}
});
findDlg.addKeyListener(27, findDlg.hide, findDlg);
//findDlg.addButton('Close', findDlg.hide, findDlg);
// findDlg.addButton('Submit', findDlg.hide, findDlg);
// findDlg.addButton('Submit', this.showAddFeed, this);
var layout = findDlg.getLayout();
findDlg.beginUpdate();
//begin update
......
//end update
layout.restoreState();
findDlg.endUpdate();
/*******************gridSearchCondition sections *************************/
//getting the data to populate gridSearchCondition in conditions section
smSearch = new YAHOO.ext.grid.SingleSelectionModel();
var cmSearch = new YAHOO.ext.grid.DefaultColumnModel([
{header: "ExternalId", width: 15, sortable: false, hidden: true},
{header: "Name", width: 180, sortable: true},
{header: "Description", width: 180, sortable: true},
{header: "Condition", width: 300, sortable: true},
{header: "Context", width: 15, sortable: false, hidden:true},
{header: "AValue", width: 15, sortable: false, hidden:true},
{header: "Attribute", width: 15, sortable: false, hidden:true},
{header: "Operator", width: 15, sortable: false, hidden:true},
{header: "SearchType", width: 15, sortable: false, hidden:true}
]);
dmSearch = new YAHOO.ext.grid.XMLDataModel({
tagName: 'Rows',
totalTag: 'TotalCount',
id: 'ExternalId',
fields: ['ExternalId', 'Name', 'Description', 'Condition', 'Context', 'AValue', 'Attribute', 'Operator', 'SearchType']
});
dmSearch.addListener('load', smSearch.selectFirstRow, smSearch, true);
dmSearch.setDefaultSort(cmSearch, 1, 'ASC');
var gridSearchCondition = new YAHOO.ext.grid.Grid('condition-grid', dmSearch, cmSearch, smSearch);
gridSearchCondition.render();
dmSearch.load('HandlerSearch.ashx');
/*******************gridSearchCondition sections *************************/
}//if
findDlg.show();
} //end init
}();
kind regards
Frank
this grid is in Page1
var XmlExample = function(){
return {
init : function(){
// limit selection in the grid to one row
// start initializing grid
sm = new YAHOO.ext.grid.SingleSelectionModel();
// listen for selection changes
sm.addListener('selectionchange', this.onSelection);
var colModel = new YAHOO.ext.grid.DefaultColumnModel([
{header: "ExternalId", width: 120, sortable: false},
{header: "Name", width: 120, sortable: true, locked: true},
{header: "Address", width: 180, sortable: true},
{header: "City", width: 115, sortable: true},
{header: "State", width: 100, sortable: true},
{header: "Zip", width: 80, sortable: true},
{header: "Phone", width: 100, sortable: true},
{header: "Fax", width: 100, sortable: true},
{header: "Mobil", width: 115, sortable: true},
{header: "Email", width: 200, sortable: true}
]);
//colModel.defaultSortable = true;
dataModel = new YAHOO.ext.grid.XMLDataModel({
tagName: 'Rows',
totalTag: 'TotalCount',
id: 'ExternalId',
fields: ['ExternalId', 'Name', 'Address', 'City', 'State', 'Zip', 'Phone', 'Fax', 'Mobil', 'Email']
});
dataModel.addListener('load', sm.selectFirstRow, sm, true);
// initialize paging
dataModel.initPaging('HandlerContact.ashx', 10);
dataModel.baseParams['value'] = value;
dataModel.baseParams['typeSearch'] = typeSearch;
dataModel.baseParams['operator'] = operator;
dataModel.baseParams['attribute'] = attribute;
dataModel.baseParams['condition'] = condition;
dataModel.setDefaultSort(colModel, 1, 'ASC');
// create the Grid
grid = new YAHOO.ext.grid.Grid('example-grid', dataModel, colModel, sm);
grid.render();
// the grid is ready, load page 1 of topics
var toolbar = grid.getView().getPageToolbar();
toolbar.addSeparator();
//toolbar.addButton({ className: 'new-topic-button', text: "New Topic", onNew.createDelegate(this)});
//toolbar.addButton({id:'btnDelete', text: '', className: 'navDelete', tooltip: 'Delete Current Record', click: this.showAddFeed.createDelegate(this)});
toolbar.addButton({id:'btnNew', text: '', className: 'navNew', tooltip: 'New Contact', click: this.onNew.createDelegate(this)});
toolbar.addButton({id:'btnEdit', text: '', className: 'navEdit', tooltip: 'Edit Current Record', click: this.onEdit.createDelegate(this)});
toolbar.addButton({id:'btnDelete', text: '', className: 'navDelete', tooltip: 'Delete Current Record', click: this.onDelete.createDelegate(this)});
toolbar.addSeparator();
toolbar.addButton({id:'btnFind', text: 'Find', className: 'doFind', tooltip: 'Find Contacts', click: this.onClickShowFindDlg.createDelegate(this)});
dataModel.loadPage(1);
grid.getColumnModel().setHidden(0, true);
grid.addListener('rowdblclick', this.onCelldblClick, this, true);
grid.addListener('cellclick', this.onCellClick, this, true);
},
onClickShowFindDlg : function(){
Search.init();
},
onSelection : function(){
selectRowId = grid.getSelectedRowId();
currentRowIndex = grid.getSelectedRowIndex();
}
} //end init
}();
YAHOO.ext.EventManager.onDocumentReady(XmlExample.init, XmlExample, true);
the js in the layout:
var Search = function(){
var findDlg;
return {
init : function(){
YAHOO.ext.state.Manager.setProvider(new YAHOO.ext.state.CookieProvider());
if(!findDlg){ // lazy initialize the findDlg and only create it once
findDlg = new YAHOO.ext.LayoutDialog("findDlg", {
modal:true,
width:650,
height:300,
shadow:true,
minWidth:300,
minHeight:300,
syncHeightBeforeShow: true,
fixedcenter: true,
center: {
titlebar: false,
autoScroll:true,
tabPosition: 'top',
closeOnTab: false,
alwaysShowTabs: false,
resizeTabs: true
},
south: {
split:true,
initialSize: 150,
minSize: 150,
maxSize: 200,
titlebar: true,
collapsible: true,
title: 'Find & Save Conditions',
animate: true
}
});
findDlg.addKeyListener(27, findDlg.hide, findDlg);
//findDlg.addButton('Close', findDlg.hide, findDlg);
// findDlg.addButton('Submit', findDlg.hide, findDlg);
// findDlg.addButton('Submit', this.showAddFeed, this);
var layout = findDlg.getLayout();
findDlg.beginUpdate();
//begin update
......
//end update
layout.restoreState();
findDlg.endUpdate();
/*******************gridSearchCondition sections *************************/
//getting the data to populate gridSearchCondition in conditions section
smSearch = new YAHOO.ext.grid.SingleSelectionModel();
var cmSearch = new YAHOO.ext.grid.DefaultColumnModel([
{header: "ExternalId", width: 15, sortable: false, hidden: true},
{header: "Name", width: 180, sortable: true},
{header: "Description", width: 180, sortable: true},
{header: "Condition", width: 300, sortable: true},
{header: "Context", width: 15, sortable: false, hidden:true},
{header: "AValue", width: 15, sortable: false, hidden:true},
{header: "Attribute", width: 15, sortable: false, hidden:true},
{header: "Operator", width: 15, sortable: false, hidden:true},
{header: "SearchType", width: 15, sortable: false, hidden:true}
]);
dmSearch = new YAHOO.ext.grid.XMLDataModel({
tagName: 'Rows',
totalTag: 'TotalCount',
id: 'ExternalId',
fields: ['ExternalId', 'Name', 'Description', 'Condition', 'Context', 'AValue', 'Attribute', 'Operator', 'SearchType']
});
dmSearch.addListener('load', smSearch.selectFirstRow, smSearch, true);
dmSearch.setDefaultSort(cmSearch, 1, 'ASC');
var gridSearchCondition = new YAHOO.ext.grid.Grid('condition-grid', dmSearch, cmSearch, smSearch);
gridSearchCondition.render();
dmSearch.load('HandlerSearch.ashx');
/*******************gridSearchCondition sections *************************/
}//if
findDlg.show();
} //end init
}();
kind regards
Frank