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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Set checkbox name for selection

Thread ID:

Created:

Updated:

Platform:

Replies:

124995 Jul 13,2016 08:45 AM UTC Jul 19,2016 10:47 AM UTC JavaScript 5
loading
Tags: ejListView
Tom Droste
Asked On July 13, 2016 08:45 AM UTC

I want to set the name for the checkbox that's generated in the listview. I've tried several things in the following example: http://jsplayground.syncfusion.com/svqyqayt , but I can't seem to make it work.

Narayanasamy Panneer Selvam [Syncfusion]
Replied On July 14, 2016 10:42 AM UTC

Hi Tom Droste,   
   
Thanks for Contacting Syncfusion support.     
  
We have analyzed your query and we can set name attribute for the checkbox which is present inside the Listview control. Please refer the code sample in the code example block and also refer the below sample link.   
Code example:   
<script type="text/javascript">   
$(function () {    
$("#defaultlistbox").ejListView({showHeader: true, enableCheckMark:true, headerTitle: "Favorite",  width:400, height: 1500});   
   
$(".e-lv-check, .e-checkbox, .e-input").ejCheckBox({ htmlAttributes : {name:"newName"}});   
        });   
    </script>   
  
   
   
In this sample we have set name for checkbox using class name. If it is not your requirement, please let us know the scenario of you are name attribute in checkbox. So that can we help you out better.   
   
   
Regards,
Narayanasamy P.   


Tom Droste
Replied On July 15, 2016 10:23 AM UTC

It is not exactly what I'm looking for. The scenario I want to use the listview in is to bind an item to several categories. Every category has a description and an id. I would like to set the id as checkbox name so my controller can handle it from there. The best case scenario I could declare the checkbox name in the html.

Selvamani Sankarappan [Syncfusion]
Replied On July 18, 2016 01:01 PM UTC

Hi Tom, 
 
Thanks for the update, 
 
We cannot set the name for each checkbox rendered using enableCheckMark property in ListView. Because they are appended with ListView item and doesn’t have unique id or name. In order to achieve your requirement, we suggest you to use template support to include check box in ListView component, where you can add name attribute for individual check box and get it from controller. Since we have added checkbox using template selection works only when you click on the check box element. Please refer the following sample: 


If still you face any difficulties, kindly get back to us. We will be happy to help you. 
 
Regards, 
Selvamani S 


Tom Droste
Replied On July 18, 2016 01:36 PM UTC

Is it with the templates still possible to have a depth in the list?

Selvamani Sankarappan [Syncfusion]
Replied On July 19, 2016 10:47 AM UTC

Hi Tom,   
Thanks for the update.  
Currently we haven’t provided with an in built support for multiple level of ListView items in template. Using JS render template we can achieve your requirement to add the depth level for ListView items. We have prepared the sample based on your requirement. Please refer the following sample:   
In above sample, the checkbox is enabled if the list item has no child elements using template support. And also you can add name attribute for individual check box and get it from controller.   
Regards,   
Selvamani S   
 


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

;