Results 1 to 6 of 6

Thread: insertHtml doesn't show the new value

  1. #1

    Question insertHtml doesn't show the new value

    Hi,

    Consider I have 2 panels, please.
    Panel B will reload panel A (in fact I am calling onrender of A from B ) later and it is the exact issue:
    In panel A, I have a tpl defined as an Ext.XTemplate. It would be the structure of btns to be added based on db result.
    I have the tpl complied at the begining, for n times usage also.
    Then during rendering the panel A:
    -Get the current node
    -Connect to DB and for each record createObj:
    ---html= tpl.apply
    ---el = Ext.DomHelper.insertHtml
    (it is exactly the part that doesnt get refreshed from panel B, but I can see the html is generated with correct values)
    ---DDel = Ext.dd.DD(el.Dom.id)
    ---And init it (for ondrag and so on)

    What I am missing, please? I tried to doLayout(!!!) for panel A but even if it is the correct thing to do, couldn't have it working
    Thanks in advance
    Last edited by sepid; 9 Dec 2009 at 10:28 PM. Reason: icons

  2. #2
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,245

    Default

    You can't render a component twice.

    Can you post your current code?

  3. #3

    Default

    total code itself is so huge... right now I am trying to just get that part out to post here...
    meanwhile... do you have any suggestion please?

    thanks

  4. #4
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,245

    Default

    It's not clear from your description what you are doing exactly, so I can't give you a hint.

    Instead of posting your code here, you could also make it accessible on a public HTTP server (port 80 only please).

  5. #5

    Default

    ok, here is the simplified code

    Ext.ns("Ext.sep");


    Ext.sep.Handlers=function(config){
    Ext.apply(this,config);
    this.cTplStrStores='<div id="cover_'+this.id+"><div ><b>{title}</b></div><table width="100%" cellspacing="0" cellpadding="0" border="0"><tbody><tr><td>&nbsp;</td></tr><tr><td>{frequency}</td></tr><tr><td>{duration}</td></tr></tbody></table></div>';
    this.storeTpl=new Ext.XTemplate('<div id="store_'+this.id" hidefocus="true" unselectable="on" onselectstart="returnfalse;"><table width="100%" cellspacing="0" cellpadding="0" border="0"><tr><td>'+this.cTplStrStores+'</td></tr></table></div>');
    this.storeTpl.compile();
    this.addEvents("doreload");
    };

    //cml-sep: Obeservable section to use
    Ext.extend(Ext.sep.Handlers,Ext.util.Observable,
    {
    doreload:function(){
    var a_p = this.ehandler.MainPanel.MainLeft;
    a_p.onmyListRenderFn(this,this.rDate);
    }
    }
    );

    Ext.sep.MainRight=function(config){
    Ext.apply(this,config);
    //some config
    };

    //Main left panel

    Ext.sep.MainLeft=function(config){
    Ext.apply(this,config);
    this.myList=new Ext.Panel(
    {
    collapsible:true,
    height:200
    });

    this.myList.on("render",this.onmyListRenderFn,this);
    this.formpanel=new Ext.form.FormPanel(
    {
    items:[
    this.something1,
    this.something2,
    this.myList]
    }
    );
    Ext.sep.MainLeft.superclass.constructor.call(
    this,{
    title:'Left side',
    layout:"fit",
    collapseMode:"mini",
    region:"west",
    width:200,
    items:[this.formpanel]});

    this.on("render",this.onRenderFn,this);
    }; //Main left panel

    Ext.extend(
    Ext.sep.MainLeft,
    Ext.Panel,
    {
    onRenderFn:function(p){},
    onResizeFn:function(p,aw,ah){
    var dh=280;
    var ch=ah-dh;
    if(this.myAPanel&&this.myAPanel.rendered){
    this.myAPanel.setHeight(ch)}
    },
    //cml-sep:adding render for predefined events
    onmyListRenderFn:

    function(p,rDate){
    console.info(p);
    rDate = rDate || new Date();
    var date_str = rDate.format('m,Y');
    //03,1991
    var given_month = date_str.substring(0,2);
    var given_year = date_str.substring(3,7);

    this.ds.loadMyStores(given_month,given_year,function(backObj){
    var rs=backObj.results;
    var eh=this.ehandler;
    eh.storeSet={};

    if(rs&&0<rs.length){
    var css="";
    for(var i=0,len=rs.length;i<len;i++){
    var myStore=rs[i];

    eh.storeSet=myStore;
    var cEl=eh.createStore(p.body,this,null,myStore);
    }
    }
    },
    this)
    );

    Ext.sep.MainPanel = function(config){
    Ext.apply(this, config);
    this.ehandler = new Ext.Sep.Handlers({
    ds:this.datasource,
    mainPanel:this
    });

    this.leftPanel = new Ext.Sep.MainLeft({
    ehandler:this.ehandler,
    ds:this.datasource
    });

    this.rightPanel = new Ext.Sep.MainRight({
    ehandler:this.ehandler,
    ds:this.datasource
    });

    Ext.Sep.MainPanel.superclass.constructor.call(this, {
    items:[
    this.leftPanel,
    this.rightPanel
    ]
    });
    };



  6. #6

    Default solved

    Okay,
    Found the issue. problem was with the node I was using for my insertHtml in calls after the first time. Had btns created in another place because of different scope of passed this

    thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •