1. #1
    Sencha User
    Join Date
    Sep 2010
    Posts
    56
    Vote Rating
    1
    Bob Wilson is on a distinguished road

      0  

    Default Problem with component loading with renderer of type "component"

    Problem with component loading with renderer of type "component"


    Hi all,

    I don't manage to load a component config dynamically with the renderer of type 'component'.
    Here is the code :

    Code:
    var wizard_page_01 = Ext.create('Ext.form.Panel', {
    	title: 'Dynamic form panel',
    	height: 200,
    	items: [
    		{
    			xtype: 'container',
    			id: 'cp1',
    			html: 'Click on the load button to load content',
    			loader:{
    				loadMask: true,
    				removeAll: true,
    				url:"../(AJAXGETCMP)?openagent",
    				renderer: 'component',
    				success: function()
    				{
    					alert('content loaded');
    				}
    			}
    		}
    	],
    	tbar: [
    		{
    			text: 'LOAD',
    			handler: function() {
    				var dynamic = wizard_page_01.child('#cp1');
    				dynamic.getLoader().load();
    			}
    		}
    	]
    });
    If I remove the 'component' renderer option, then it loads correctly my server response content, but as html format, of course.

    My server response is this :
    Code:
    {"success": true, "data": {id: 'newCmp', xtype: 'container', border: 1, height: 250, html: 'Content loaded successfully'}}
    The Ext documentation is not clear about how the server response should be when it comes to 'component' renderer.

  2. #2
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,814
    Vote Rating
    607
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    It expects something that can be passed to container.add(). In this case you might want to use a custom renderer function. Would agree the docs could be beefed up a bit to indicate what they expect.
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  3. #3
    Sencha User
    Join Date
    Sep 2010
    Posts
    56
    Vote Rating
    1
    Bob Wilson is on a distinguished road

      0  

    Default Component formatting

    Component formatting


    Ok, thank you for your answer.
    I've read the API again, but my server response IS a component following the docs example.

    What do I miss in the syntax ?
    (note I've also tried to add some "[ ]" around the component config, just in case)

  4. #4
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,814
    Vote Rating
    607
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    What you're returning is a JSON block, the stuff inside "data" is what one should pass to a component.

    So if your response is:

    Code:
    {id: 'newCmp', xtype: 'container', border: 1, height: 250, html: 'Content loaded successfully'}
    It will work.
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  5. #5
    Sencha User
    Join Date
    Sep 2010
    Posts
    56
    Vote Rating
    1
    Bob Wilson is on a distinguished road

      0  

    Default success & failure ?

    success & failure ?


    Ok, I'll try this in a few minutes because I got stucked into this for a long time now.
    I just don't understand why my server should throw an answer which is not in the "Ajax way", with "success" : true/false in the response, and "data" tag as... the data.

    Sounds strange to me.

    Or maybe you mean that I have to parse the response and extract the "data" part of the JSON object ?
    Not sure to understand.

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi