PDA

View Full Version : View in a dialog won't render



slidenv
4 Jan 2007, 8:26 AM
Hi all,

I'm trying to put a view in a dialog but for some reason the view is not rendering. I've made certain the xml coming in from the server is valid, uses the xml content-type and is loading properly - I did that by placing an alert in yui-ext.js. All I see when the dialog comes up is the content from element 'feeds'.

Also, this is basically a hack of the layout dialog and feed viewer. I have included the feedviewer css on my page so I have the css declarations for my-feeds and feeds.

Any help would be appreciated.

Thanks,

Mark

***

Here's the HTML:

<div id="conditions-dlg" style="visibility:hidden;">
<div class="ydlg-hd">Conditions</div>
<div class="ydlg-bd">
<div id="center" class="ylayout-inactive-content">
hi there1
</div>
</div>
<div id="feeds" class="ylayout-inactive-content">
hi there 3
<div id="myfeeds-body" class="feed-list">
hi there2</div>
</div>
</div>

Here's the JS:

var Conditions = function(){
var dialog;
var dm;

return {
init : function(){
getEl(document.body, true).toggleClass('ytheme-gray');
},

showDialog : function(dom){
if(!dialog){
dialog = dialog = new YAHOO.ext.LayoutDialog("conditions-dlg", {
modal:false,
width:600,
height:400,
shadow:true,
minWidth:300,
minHeight:300,
shim: true,
constraintoviewport: false,
fixedcenter: true,
center: {
initialSize: 400,
minSize: 175,
maxSize: 400,
titlebar: true,
collapsible: true,
animate: true,
autoScroll:false,
useShim:true,
cmargins: {top:0,bottom:2,right:2,left:2}
}
});

dialog.addKeyListener(27, dialog.hide, dialog);
dialog.addButton('Ok', dialog.hide, dialog);

var layout = dialog.getLayout();
layout.beginUpdate();
layout.add('center', new YAHOO.ext.ContentPanel('feeds', {title: 'Conditions for', fitToFrame:true, resizeEl:'myfeeds-body'}));
this.createContentView("myfeeds-body");
layout.endUpdate();

}
setTimeout(function(){
this.loadContent();
}.createDelegate(this), 50);

dialog.show(dom);
},

getDialog : function()
{
return dialog;
},

createContentView : function(el)
{
dm = new YAHOO.ext.grid.XMLDataModel({
tagName: 'item',
id: 'use-index',
fields: ['id', 'name','description']
});

dm.on('load', this.onLoad, this, true);

var tpl = new YAHOO.ext.DomHelper.Template(
'<a id="{id}" href="javascript: void(0);"><span class="body">{name}
<span class="desc">{desc}</span></span></a>'
);

var view = new YAHOO.ext.View(el, tpl, dm, {singleSelect:true, selectedClass:'selected-article'});

view.prepareData = function(data)
{
return {
id: data[0],
name: data[1],
desc: data[2].ellipse(50)
};
}
view.on('click', this.editContent, this, true);
},

loadContent : function(){
dm.load('getConditions.php');
},

onLoad : function(){
alert("done");
},

};
}();

// using onDocumentReady instead of window.onload initializes the application
// when the DOM is ready, without waiting for images and other resources to load
YAHOO.ext.EventManager.onDocumentReady(Conditions.init, Conditions, true);

Animal
5 Jan 2007, 12:01 AM
Please post a link to a page showing your ptoblem.