$('#Meals').data('api').load({ oparams: { selectall: true } }); doesn't work
Hi, I did exactly as the following link
http://aspnetawesome.com/forum/question/461/how-to-check-all-items-of-an-ajaxcheckboxlist
and it didnt do anything
Sean
asked
at 10 Sep 2015
Answers
-
yes, that won't work in the current version, but you can do this instead:
var allv = JSON.stringify($('#ParentCategory').parent().find(':checkbox').map(function(){ return $(this).attr('value'); }).get());
and use KeyContent instead of SelectableItem as shown in the demos
$('#ParentCategory').val(allv).change();
$('#ParentCategory').data('api').render($('#ParentCategory').data('o'));Omuanswered at 10 Sep 2015-
That works! So I am assuming the code is assigning the stringified json array to ParentCategory.at 11 Sep 2015 Sean
-
I'd like to ask more question regarding this, what if I want to do something on client side(js) on checkboxlist checked/unchecked, how should I implement this? And will the select all/clear action gets the same behavior or do I have to do extra coding to hook them up?at 11 Sep 2015 Sean
-
this is done on the client side, it's setting the value and calling api.render, also the change event is triggeredat 11 Sep 2015 Omu
-
i did something like $('#ParentCategory').on('aweload',....... is there a built-in events like awevaluechange that I can handle?at 11 Sep 2015 Sean
-
you can handle 'change'at 11 Sep 2015 Omu
-
Thank you very much, they all work now.at 11 Sep 2015 Sean
-