irishdunn
10-16-2006, 09:57 AM
Hey there jack, sorry to be a bother but when I implemented build 32.3 this morning I noticed that all of the tollbar buttons on my page were nonresponsive to the evenlisteners I assigned. Rolling back to 32.2 fixed my problem but I figured you would want to know of my complication. I can give you my source if you please, but dont want to clutter this thread with it untill you request it.
irishdunn
10-17-2006, 07:17 PM
i was trying to patch the patched yui-ext, so now I have another problem. You are going to love me.
this.grid.container.beginMeasure() -- my box is undefined
var application = function(){
var USERDATA_DATAMODEL_SNAPSHOT = null; // Because filter() removes members from the datamodel we will need
// capture a datamodel to load back in when the filter is removed.
var ssgRoles = [
['Administrator'],
['Power User'],
['Master Investor'],
['Teh Clown']
];
var mmbRoles = [
['Destroyer'],
['Creator'],
['Black ball'],
['The Color Blue'],
['Useless'],
['Corruptor'],
['Insano'],
['Last One']
];
return {
init : function(){
// APPLICATION GRID //
//-----------------------------------------------------------------------------------//
var myData = [ ['SSG'],['MMB'] ];
var dataModel = new YAHOO.ext.grid.DefaultDataModel(myData);
var sort = YAHOO.ext.grid.DefaultColumnModel.sortTypes;
var colModel = new YAHOO.ext.grid.DefaultColumnModel([
{header: "Applications", width: 198, sortable: true, sortType: sort.asUCString}
]);
var sm = new YAHOO.ext.grid.SingleSelectionModel();
sm.addListener('selectionchange', this.loadUserAndRoleGrid, this, true);
this.appGrid = new YAHOO.ext.grid.Grid('application_grid', dataModel, colModel, sm);
this.appGrid.render();
// Everything drives off of the application grid
// Call everything else on the page to render
this.initUserGrid();
this.initRoleGrid();
this.initUserTabs();
// this.initUserTabRoleGrid();
// this.initUserTabProfileGrid();
this.initUserToolbar();
this.initUserSearch();
this.initRoleToolbar();
this.initUserPanel();
this.initConfirmPanel();
}, // End application_grid
// USER GRID //
//-----------------------------------------------------------------------------------//
initUserGrid : function(){
var sort = YAHOO.ext.grid.DefaultColumnModel.sortTypes;
// Formatters come first so they can be called in the colmodel
var boolFormat = function(value)
{
if(value == 'true')
{
return '<input>';
}
if(value == 'false')
{
return '<input>';
}
if(value == '')
{
return '';
}
};
var dateFormat = function(value)
{
return value.dateFormat('M d, Y');
};
var parseDate = function(value)
{
return new Date(Date.parse(value));
};
// Creation of the components of the grid follows
var colModel = new YAHOO.ext.grid.DefaultColumnModel([
{header: "User Name", width: 120, sortable: true, sortType: sort.asUCString},
{header: "Approved", width: 65, sortable: false, renderer: boolFormat},
{header: "Locked", width: 65, sortable: false, renderer: boolFormat},
{header: "Online", width: 65, sortable: false, renderer: boolFormat},
{header: "Created", width: 80, sortable: false, renderer: dateFormat},
{header: "Last Active", width: 80, sortable: false, renderer: dateFormat},
{header: "Last Lockout", width: 80, sortable: false, renderer: dateFormat}
]);
var schema =
{
tagName: 'user',
id: 'use-index',
fields: ['username',
'isApproved',
'isLockedOut',
'isOnline',
'creationDate',
'lastActivityDate',
'lastLockoutDate']
};
this.userData = new YAHOO.ext.grid.XMLDataModel(schema);
this.userData.addPreprocessor(4, parseDate);
this.userData.addPreprocessor(5, parseDate);
this.userData.addPreprocessor(6, parseDate);
this.userData.setDefaultSort(colModel, 0, "DESC");
// Event Subscibers
function onRowDoubleClick(grid, rowIndex, e){
YAHOO.user.panel.popup.setHeader("User Specific Stats for: " + application.userGrid.dataModel.data[rowIndex][0]);
YAHOO.user.panel.popup.setBody( // I am directly referencing the dataModel of the grid... we will want to reference the XML in the datamodel
"User Name: " + application.userGrid.dataModel.data[rowIndex][0] +"\n"+
"User Email: " + application.userGrid.dataModel.data[rowIndex][1] +"\n"+
"Is Approved: " + application.userGrid.dataModel.data[rowIndex][2] +"\n"+
"Is Locked Out: " + application.userGrid.dataModel.data[rowIndex][3] +"\n"+
"Is Online :" + application.userGrid.dataModel.data[rowIndex][4] +"\n"
);
YAHOO.user.panel.popup.show();
}
this.userGrid = new YAHOO.ext.grid.Grid('user_grid', this.userData, colModel);
this.userGrid.render();
this.userGrid.addListener('rowdblclick', onRowDoubleClick);
}, // End user_grid
// ROLE GRID //
//-----------------------------------------------------------------------------------//
initRoleGrid : function(){
this.roleData = new YAHOO.ext.grid.DefaultDataModel([]);
var sort = YAHOO.ext.grid.DefaultColumnModel.sortTypes;
var colModel = new YAHOO.ext.grid.DefaultColumnModel([
{header: "Roles", width: 198, sortable: true, sortType: sort.asUCString}
]);
this.roleGrid = new YAHOO.ext.grid.Grid('role_grid', this.roleData, colModel);
this.roleGrid.render();
}, // End role_grid
// USER TABS //
//-----------------------------------------------------------------------------------//
initUserTabs : function(){
var tabs = new YAHOO.ext.TabPanel('user_tabs');
tabs.addTab('user', "User");
tabs.addTab('profile', "Profile");
tabs.addTab('roles', "Roles");
tabs.activate('user');
}, // End User Specific Tabs
// TAB ROLE GRID //
//-----------------------------------------------------------------------------------//
initUserTabRoleGrid : function(){
var sort = YAHOO.ext.grid.DefaultColumnModel.sortTypes;
var yg = YAHOO.ext.grid;
// Formatters come first so they can be called in the colmodel
var boolFormat = function(value)
{
if(value == 'true')
{
return '<input>';
}
if(value == 'false')
{
return '<input>';
}
if(value == '')
{
return '';
}
};
var dateFormat = function(value)
{
return value.dateFormat('M d, Y');
};
var parseDate = function(value)
{
return new Date(Date.parse(value));
};
// Creation of the components of the grid follows
var colModel = new YAHOO.ext.grid.DefaultColumnModel([
{header: "Editable Roles", width: 330, sortable: true, sortType: sort.asUCString},
{header: "True/False", width: 330, sortable: true, sortType: sort.asUCString, editor: new yg.CheckboxEditor()}
]);
var schema =
{
tagName: 'role',
id: 'use-index',
fields: ['roleName',
'hasRole']
};
this.tabRoleGridData = new YAHOO.ext.grid.XMLDataModel(schema);
this.userTabRoleGrid = new YAHOO.ext.grid.Grid('tabbed_role_grid', this.tabRoleGridData, colModel);
this.userTabRoleGrid.render();
this.tabRoleGridData.load('../Scripts/yui/authentication/demoRoles.xml');
}, // End Role Grid inside Tabs
// TAB PROFILE GRID //
//-----------------------------------------------------------------------------------//
initUserTabProfileGrid : function(){
}, // End Role Grid inside Tabs
// USER TOOLBAR //
//-----------------------------------------------------------------------------------//
initUserToolbar : function(){
var tb = new YAHOO.ext.Toolbar('user_edit');
tb.addButton({text: 'Create User', className: 'new-user', click: newUser});
tb.addSeparator();
deleteBtn = tb.addButton({text: 'Delete User', className: 'delete-user', click: deleteUser});
function newUser()
{
alert("Popup should fire here to create a new user");
}
function deleteUser()
{
alert("should check for selectedRowIndex>0!=null\nthen make sure to ask if they are sure.");
}
}, // End User Toolbar
// USER SEARCH //
//-----------------------------------------------------------------------------------//
initUserSearch : function (){
var tb = new YAHOO.ext.Toolbar('user_search');
tb.addButton({text: 'Search for User', className: 'lookup-user', click: userLookup});
tb.addSeparator();
tb.addButton({text: 'Show all Users', className: 'all-users', click: showAll});
tb.addSeparator();
tb.addText('Filter Users: ');
function userLookup()
{
alert("dont ever click me again");
}
function showAll()
{
alert("I dont work");
}
}, // End User Search
// ROLE TOOLBAR //
//-----------------------------------------------------------------------------------//
initRoleToolbar : function(){
var tb = new YAHOO.ext.Toolbar('role_edit');
tb.addButton({text: 'New Role', className: 'new-role', click: newRole});
tb.addSeparator();
deleteBtn = tb.addButton({text: 'Delete Role', className: 'delete-role', click: deleteRole}); // this is an object!
function newRole()
{
// Creation of the literal HTML for the popup body. ?????PROTOTYPE???????
var htmlBody = "<label>Role Name:<input></label>
" +
"<label>Dummy Field:<input></label>
" +
"<input>Dummy Checkbox</label><label>" +
"<input>Dumy Checkbox 2</label>" +
"
<input>" +
"<input>";
YAHOO.user.panel.popup.setHeader("ADDING A ROLE");
YAHOO.user.panel.popup.setBody(htmlBody);
YAHOO.user.panel.popup.show();
}
function deleteRole()
{
var handleCancel = function(e)
{
alert("This is not developed");
YAHOO.confirm.panel.conf.hide();
}
var handleOK = function(e)
{
alert("This is not Developed");
YAHOO.confirm.panel.conf.hide();
}
var nothingOK = function(e)
{
YAHOO.confirm.panel.conf.hide();
}
var rowIndex = application.appGrid.getSelectedRowIndex();
if(rowIndex == -1) // NOTHING SELECTED
{
YAHOO.confirm.panel.conf.setHeader("Warning!");
YAHOO.confirm.panel.conf.setBody("You Have to Select a Role to Delete");
YAHOO.confirm.panel.conf.cfg.setProperty("icon",YAHOO.widget.SimpleDialog.ICON_WARN);
YAHOO.confirm.panel.conf.cfg.setProperty("buttons",{ text:"OK", handler:nothingOK, isDefault:true });
YAHOO.confirm.panel.conf.show();
}
else if (rowIndex >= 0)
{
YAHOO.confirm.panel.conf.setHeader("Warning!");
YAHOO.confirm.panel.conf.setBody("Please confirm Role Deletion");
YAHOO.confirm.panel.conf.cfg.setProperty("icon",YAHOO.widget.SimpleDialog.ICON_WARN);
YAHOO.confirm.panel.conf.cfg.setProperty("buttons",[{ text:"OK", handler:handleOK, isDefault:true },{ text:"Cancel", handler:handleCancel }]);
YAHOO.confirm.panel.conf.show();
}
}
}, // End Role Toolbar
// POPUP WINDOW //
//-----------------------------------------------------------------------------------//
initUserPanel : function(){
var userConfig = { modal: false, width:"400px", height:"400px", fixedcenter: true, constraintoviewport: true, underlay:"shadow", close:true, visible:false, draggable:true, effect:[{effect:YAHOO.widget.ContainerEffect.FADE,duration :0.25},{effect:YAHOO.widget.ContainerEffect.FADE,d uration:0.25}]};
YAHOO.namespace("user.panel");
YAHOO.user.panel.popup = new YAHOO.widget.Panel("userPanel", userConfig);
YAHOO.user.panel.popup.render();
}, // End User Popup
// CONFIRMATION WINDOW //
//-----------------------------------------------------------------------------------//
initConfirmPanel : function(){
var userConfig = { visible:false, width: "20em", effect:[{effect:YAHOO.widget.ContainerEffect.FADE,duration :0.25},{effect:YAHOO.widget.ContainerEffect.FADE,d uration:0.25}], fixedcenter:true, modal:false, draggable:true };
YAHOO.namespace("confirm.panel");
YAHOO.confirm.panel.conf = new YAHOO.widget.SimpleDialog("confPanel", userConfig);
YAHOO.confirm.panel.conf.render();
}, // End Confirmation Popup
// FUNCTION BLOCK //
//-----------------------------------------------------------------------------------//
loadUserAndRoleGrid : function(){ // Loading function for the User Grid *FUNCTION*
var rowIndex = this.appGrid.getSelectedRowIndex();
if(rowIndex == -1) // NOTHING SELECTED
{
/* Check for no selection*/
}
else
{
this.userData.removeAll();
this.roleData.removeAll();
if(rowIndex == 0)
{
this.userData.load('../Scripts/yui/authentication/SSGuserData.xml');
this.roleData.addRows(ssgRoles);
}
else if(rowIndex == 1)
{
this.userData.load('../Scripts/yui/authentication/MMBuserData.xml');
this.roleData.addRows(mmbRoles);
}
}
} // End dataload function for user and role grids
}
}();
YAHOO.util.Event.on(window, 'load', application.init, application, true);
irishdunn
10-19-2006, 02:06 PM
Ok I started a new project this morning and nabbed your new 32.3.1 file. I am getting the same goofy error. Here is my code:
var ngagement = function(){
/*------------------Globals------------------*/
/*--------------FORMATTERS(GRID)-------------*/
var boolFormat = function(value)
{
if(value == 'true')
{
return '<input>';
}
if(value == 'false')
{
return '<input>';
}
if(value == '')
{
return '';
}
};
var dateFormat = function(value)
{
return value.dateFormat('M d, Y');
};
var parseDate = function(value)
{
return new Date(Date.parse(value));
};
/*--------------ALL COMPONENTS DRIVE FROM INIT-------------*/
return {
init : function(){ // MAIN TABLE
var sort = YAHOO.ext.grid.DefaultColumnModel.sortTypes;
var colModel = new YAHOO.ext.grid.DefaultColumnModel([
{header: "Company", width: 200, sortable: true, sortType: sort.asUCString},
{header: "Street", width: 200, sortable: true, sortType: sort.asUCString},
{header: "City", width: 200, sortable: true, sortType: sort.asUCString}
]);
var schema = {
tagName: 'company',
id: 'use-index',
fields: ['FullName',
'Street1',
'City']
};
this.companyData = new YAHOO.ext.grid.XMLDataModel(schema);
//this.userData.addPreprocessor(4, parseDate); PreProcessor
this.companyData.setDefaultSort(colModel, 0, "DESC");
this.companyGrid = new YAHOO.ext.grid.Grid('company-grid', this.companyData, colModel);
this.companyGrid.render();
//this.companyGrid.load('XML');
}
}
}();
YAHOO.util.Event.on(window, 'load', ngagement.init, ngagement, true);
jack help!!! lol :lol:
irishdunn
10-19-2006, 02:16 PM
I so found it.
i started killing the library peice by peice up on the top, the Element-min.js was from your original build and was making that error pop up, so i nabbed a new Element-min.js from your latest build and everything ran A-O-K so now im back on task....
any insight into why this was the problem?
vBulletin® v3.6.7, Copyright ©2000-2008, Jelsoft Enterprises Ltd.