1. #1
    Ext User
    Join Date
    Mar 2007
    Posts
    40
    Vote Rating
    0
    n01champion is on a distinguished road

      0  

    Default Bug in Grid

    Bug in Grid


    I have a grid inside a <div> thats is inside a contentpanel

    when I close the panel and create it again (never reloading the page) i get an error.

    screenshot available
    Attached Images

  2. #2
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,546
    Vote Rating
    64
    Animal is a jewel in the rough Animal is a jewel in the rough Animal is a jewel in the rough

      0  

    Default


    The panel's DOM elements are removed when the panel is closed. Normally, that's what you want: the user closes the panel and it "goes away".

    You will have to access the TabPanelItem that's created as a result of adding the ContentPanel to the Region. Add a handler to its "onbeforeclose" event, and save your grid container DOM element: move it to some place else in the document and add the class "x-layout-inactive-content" to it until you need it again.

    When you need it on another ContentPanel, just remove the class, and re-add the GridPanel (you should have saved a reference to the GridPanel object that you created).

  3. #3
    Ext User
    Join Date
    Mar 2007
    Posts
    40
    Vote Rating
    0
    n01champion is on a distinguished road

      0  

    Default


    Question... why does the dome element of the grid have to be saved? Couldn't you just re-created the dom place holder by appending a child element to the content panel?

    Oh I forgot to add.. this only happens when you resize the window... something to do with the monitorWindowResize... it worked fine when I set this property to false on the nested layout


    Could it be the way I'm loading the contentpanel:

    Code:
    layout.add('center', new Ext.ContentPanel('web-accounts', {
            autoCreate:true,
            title: 'Web Accounts',
    	fitToFrame:true,
    	closable:true,
    	url:{url:'setup_webaccounts/index.php', scripts:true},
    	loadOnce:true
    }));
    and the page that is being loaded has:

    Code:
    <script type="text/javascript" src="setup_webaccounts/js/web_accounts.js"></script>
    <link rel="stylesheet" type="text/css" href="setup_webaccounts/css_webaccounts.css"/>
    
    <div id="web-account">
    	<div id="web-account-tb"></div>
    	<div id="web-account-content" style="padding:10px;">
    		<fieldset id="webuser-search">
    			<legend>Account Search</legend>
    			<div>
    				<table width="100%" border="0" cellpadding="0" cellspacing="5">
    					<tr>
    						<td>Login: </td><td><input id="s-login" type="text"></td>
    						<td>Name:  </td><td><input id="s-fullname" type="text"></td>
    						<td rowspan="3" width="62" valign="top"><img src="setup_webaccounts/img/searchiconbig.gif"></td>
    					</tr>
    					<tr>
    						<td>Corporation: </td><td><input id="s-companyname" type="text"></td>
    						<td>Customer Division:  </td><td><input id="s-division" type="text"></td>
    					</tr>
    					<tr>
    						<td>Security Label: </td>
    						<td>
    							<input id="s-securitylabel" autocomplete="off">
    						</td>
    					</tr>
    				</table>
    			</div>
    		</fieldset>
    		<br>
    		<fieldset>
    			<legend>Results</legend>
    			<div id="webuser-search-results"></div>      //holder for grid
    		</fieldset>
    		
    	</div>
    </div>

  4. #4
    Sencha User
    Join Date
    Mar 2007
    Posts
    7,854
    Vote Rating
    4
    tryanDLS is on a distinguished road

      0  

    Default


    You don't have to save the grid's DOM but if you don't, and want to redisplay later, you have to rebuild the entire DOM structure of the grid. Depending on how complex your grid is, this could be expensive - not only building the HTML, but rewiring events.

    Also, in your sample, I think you want to move the CSS file from loaded page to your main page. When you dynamically load content like that, the CSS isn't going to get processed.

  5. #5
    Sencha User jack.slocum's Avatar
    Join Date
    Mar 2007
    Location
    Tampa, FL
    Posts
    6,955
    Vote Rating
    17
    jack.slocum will become famous soon enough jack.slocum will become famous soon enough

      0  

    Default


    You will need to destroy() the grid before overwriting it's HTML.
    Jack Slocum
    Ext JS Founder
    Original author of Ext JS 1, 2 & 3.
    Twitter: @jackslocum
    jack@extjs.com

  6. #6
    Ext User
    Join Date
    Mar 2007
    Posts
    40
    Vote Rating
    0
    n01champion is on a distinguished road

      0  

    Default


    Yes.. I figured that out when i started looking at the dom objects... and you should also remove the event listeners as well


    Thanks