EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: bdearborn on December 14, 2015, 07:05:38 PM



Title: Datalist radiobutton
Post by: bdearborn on December 14, 2015, 07:05:38 PM
Can I override the datalist component so that it will show a radiobutton instead of a checkbox?


Title: Re: Datalist radiobutton
Post by: bdearborn on December 14, 2015, 07:06:23 PM
From JeasyUI Support:

To get a radio button on the left of item, please use the 'formatter' function to define a radio element.

         $('#dl').datalist({
            textFormatter: function(value,row){
               return '<input type="radio" name="name1">' + value;
            },
            onSelect: function(index,row){
               var tr = $(this).datalist('options').finder.getTr(this, index);
               tr.find('input[type=radio]')._propAttr('checked', true);
            }
         })