Turn multiselect on and off in javascript?

QuestionsTurn multiselect on and off in javascript?
Glenn asked 4 years ago

Hi Abu,

When I click a button that calls jscript what is the call to turn multiselect on or off?

Thanks
Glenn

2 Answers
Abu Ghufran answered 4 years ago

There is no built-in function to do this. However, you can toggle the checkbox of multiselect using jquery code.

Use this code. This will toggle column display and selection function as well.

<input type=”button” value=”Multiselect” onclick=”toggle_multiselect()”>

<script>
function toggle_multiselect()
{
if ($(‘#list1 .cbox:visible’).length > 0)
{
$(‘#list1’).jqGrid(‘hideCol’, ‘cb’);
jQuery(‘.jqgrow’).click(function(){ jQuery(‘#list1’).jqGrid(‘resetSelection’); this.checked = true; });
}
else
{
$(‘#list1’).jqGrid(‘showCol’, ‘cb’);
jQuery(‘.jqgrow’).unbind(‘click’);
}
}
</script>

Glenn answered 4 years ago

Thanks Abu,

Regards,
Glenn

Your Answer

2 + 3 =

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating / 5. Vote count:

As you found this post useful...

Follow us on social media!

We are sorry that this post was not useful for you!

Let us improve this post!