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. Image for the cookie policy date

jsrender templates in ListBox?

Hello,

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

Thanks,
Randy Craven


5 Replies

SS Selvamani Sankarappan Syncfusion Team 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.   
 



RC Randy Craven April 7, 2017 03:02 PM UTC

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


SS Selvamani Sankarappan Syncfusion Team 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. 



AS Ahmed Sherien August 15, 2017 02:25 PM UTC

Is there a way to do for loops like jsrender?



AP Arun Palaniyandi Syncfusion Team 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.    


Loader.
Live Chat Icon For mobile
Up arrow icon