1. #1
    Sencha User
    Join Date
    Sep 2011
    Posts
    40
    Vote Rating
    0
    khangwei is on a distinguished road

      0  

    Default Answered: Empty Xtemplate?

    Answered: Empty Xtemplate?


    Hi,

    I have a XTemplate as below:

    commentInfo = new Ext.XTemplate(
    '<tpl for=".">',
    '{name} at {timestamp} <br />',
    '{comment}',
    '</tpl>'
    );
    if there are no objects/an empty array is being passed in.. how can i have an alternative display of "no comments are posted" ??

    please advise!

    thanks!

  2. xcount only works within the loop. Try this:

    Code:
                '<tpl if="values.length <= 0">',
                    'no comments are posted',
                '</tpl>',
    Note: This works in ExtJS and I assume it will work in Touch but I haven't tested it .

  3. #2
    Sencha User
    Join Date
    Oct 2011
    Posts
    4
    Vote Rating
    0
    midnight-coder is on a distinguished road

      0  

    Default


    khangwei,

    You could use a data view, which lets you define an "emptyText" property, but if you want to use an XTemplate object directly without any of that extra complexity, I think the solution in your case is to use the xcount value combined with some template logic. For instance:

    Code:
    commentInfo = new Ext.XTemplate(
       '<tpl for=".">',
          '{name} at {timestamp} <br />',
          '{comment}',
       '</tpl>',
       '<tpl if="xcount == 0">',
          'no comments are posted',
       '</tpl>'
    );
    Perhaps there is a better way, but this should work fine.

  4. #3
    Sencha User
    Join Date
    Sep 2011
    Posts
    40
    Vote Rating
    0
    khangwei is on a distinguished road

      0  

    Default


    Hi,

    I did this but it is still not working,

    any idea why?

    Thank you!

    Code:
            
    		commentInfo = new Ext.XTemplate(
    			'<tpl if="xcount == 0">',
    				'No comments are posted',
    			'</tpl>',
    			'<tpl if="xcount &gt; 0">',
    			'<tpl for=".">',
    			'{name} at {timestamp} <br />',
    			'{comment}',
    			'</tpl>'
    		);

  5. #4
    Sencha User
    Join Date
    Sep 2011
    Posts
    40
    Vote Rating
    0
    khangwei is on a distinguished road

      0  

    Default


    Bumping for help!

    Thank you.

  6. #5
    Sencha User
    Join Date
    Sep 2011
    Posts
    40
    Vote Rating
    0
    khangwei is on a distinguished road

      0  

    Default


    Hi all..

    Still no solutions for this, can anyone help me?

    Thank you!

  7. #6
    Sencha User bclinton's Avatar
    Join Date
    Nov 2007
    Posts
    265
    Answers
    1
    Vote Rating
    5
    bclinton will become famous soon enough

      0  

    Default


    xcount only works within the loop. Try this:

    Code:
                '<tpl if="values.length <= 0">',
                    'no comments are posted',
                '</tpl>',
    Note: This works in ExtJS and I assume it will work in Touch but I haven't tested it .

  8. #7
    Sencha User
    Join Date
    Sep 2011
    Posts
    40
    Vote Rating
    0
    khangwei is on a distinguished road

      0  

    Default


    thanks for your help!

Thread Participants: 2

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar