We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

jsrender templates in ListBox?

Thread ID:

Created:

Updated:

Platform:

Replies:

129878 Apr 6,2017 10:41 PM UTC Aug 16,2017 11:12 AM UTC JavaScript 5
loading
Tags: ejListBox
Randy Craven
Asked On April 6, 2017 10:41 PM UTC

Hello,

Is it possible to use jsrender templates with ejListBox, similar to for example the templates used by ejTreeView? 

Thanks,
Randy Craven


Selvamani Sankarappan [Syncfusion]
Replied On April 7, 2017 08:52 AM UTC

Hi Randy,   
   
Thanks for using Syncfusion products.   
   
No, it is not possible to use JS render templates to the ListBox component because the ListBox component does not have the JS render template support. But, you can achieve the template support using our template property. Refer to the following code example:   
  
[script]   
  $('#selectExperts').ejListBox({   
            dataSource: empList, height: "240",   
            template: '<div><img class="eimg" src="http://js.syncfusion.com/demos/web/content/images/Employees/${eimg}.png" alt="employee"/>' +   
                     '<div class="ename"> ${text} </div><div class="desig"> ${desig} </div><div class="cont"> ${country} </div></div>'   
        });   
  
   
Please refer to the following sample: http://jsplayground.syncfusion.com/cwmwhkwp   
   
If this does not meet your requirement, then please get back to us with more details and we will be happy to help you.   
   
Regards,   
   
Selvamani S.   
 


Randy Craven
Replied On April 7, 2017 03:02 PM UTC

Hello Selvamani,
That was the information I needed.  Thank you.
Randy Craven

Selvamani Sankarappan [Syncfusion]
Replied On April 10, 2017 07:24 AM UTC

Hi Randy, 
 
Thanks for the update. 
 
Please let us know if you need any further assistance. 
 
Regards, 
 
Selvamani S. 


Ahmed Sherien
Replied On August 15, 2017 02:25 PM UTC

Is there a way to do for loops like jsrender?


Arun Palaniyandi [Syncfusion]
Replied On August 16, 2017 11:12 AM UTC


Hi Ahmed Sherien,   
  
Thanks for contacting Syncfusion Support.       
  
In ListBox control, the template property accepts only string values.   
  
Kindly refer to the following API documentation link: https://help.syncfusion.com/api/js/ejlistbox#members:template   
  
But to use jsrender script template in ListBox, you can use the targetID property and bind the script template rendered as <ul> <li> elements to the ListBox manually.    
  
  
Kindly refer to the following link for the playground sample: http://jsplayground.syncfusion.com/v3jet0ns   
    
Please let us know whether the provided information is helpful to achieve your requirement or not?  
               
Regards,    
Arun P.    


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;