javascript - Using Select2 with Jeditable -
i new jquery plugins know basic jquery.
i trying combine select2 plugin jeditable in html table. have done want. problem dropdown shows , closed. have made jsfiddle of have done
html code:
<table> <tr> <th>location</th> </tr> <tr> <td class="sites_select">location 1</td> </tr> </table>
jquery code:
$(".sites_select").editable("localhost/timesheet/sites/update", { data : "{'lorem ipsum':'lorem ipsum','ipsum dolor':'ipsum dolor','dolor sit':'dolor sit'}", type: "select", onblur: 'ignore' }).on('click', function () { $(this).find('select').select2({}); }); $(document).on('change', '.sites_select select', function () { $(this).trigger("submit"); });
only problem having when click shows , hide immediately. appreciated.
$(".sites_select").editable("localhost/timesheet/sites/update", { data : "{'lorem ipsum':'lorem ipsum','ipsum dolor':'ipsum dolor','dolor sit':'dolor sit'}", type: "select", onblur: 'ignore' }).on('click', function () { if($(this).find('.select2').length <= 0){ $(this).find('select').select2({}); } }); $(document).on('change', '.sites_select select', function () { $(this).trigger("submit"); })
Comments
Post a Comment