ASP.net
Awesome
Learn
Forum
Buy
Demos
Sign In
☾
☀
Switch to
Dark
Light
Mode
this site works best with javascript enabled
Ask Question
$('#Meals').data('api').load({ oparams: { selectall: true } }); doesn't work
Title:
B
I
{code}
?
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
Save Changes
Cancel
Sean
asked at 10 Sep 2015
Answers
B
I
{code}
?
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()); $('#ParentCategory').val(allv).change(); $('#ParentCategory').data('api').render($('#ParentCategory').data('o')); and use KeyContent instead of SelectableItem as shown in the demos
Save Changes
Cancel
Omu
answered at 11 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 triggered
at 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
please
Sign In
to leave an answer
By accessing this site, you agree to store cookies on your device and disclose information in accordance with our
cookie policy
and
privacy policy
.
OK