Multiselect onload default value

QuestionsMultiselect onload default value
Hafiz asked 1 year ago

Hello Abu,

I use this kind of multiselect where the key and value is STRING. I tried to give them a default value but got this error –
Uncaught Error: cannot call methods on multiselect prior to initialization; attempted to call method ‘refresh’
But when I do this code, –

$(“#gs_status > option[value=’Waiting’]”).prop(‘selected’, true);
$(“#gs_status > option[value=’In Progress’]”).prop(‘selected’, true);
$(“#gs_status > option[value=’On Hold’]”).prop(‘selected’, true);
$(“#gs_status”).multiselect();
$(“#gs_status”).multiselect(‘refresh’);
jQuery(“#list1”)[0].triggerToolbar();

The phpgrid table not displaying any data. I’ve tried to attempt many solutions given in this forum and others but all of them is not working. I need this default value to be onload, but is there any other solution to do this? Here I attached the image for my multiselect.

https://imgur.com/LAkRIYt

 

Thanks in advance.

Regards.

1 Answers
Abu Ghufran Staff answered 11 months ago

Pretty late reply, but if still some one is interested, the correct code to initialize multi-select filter can be seen here in demo.

Demo: http://phpgrid.org/demo/demos/integrations/multiselect-filter.php

Code: http://phpgrid.org/demo/demos/integrations/multiselect-filter.phps

Line 162,166,176

_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
Your Answer

12 + 1 =

Login with your Social Id:

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 / 5. Vote count: 1

No votes so far! Be the first to rate it.

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

Let us improve this post!

Tell us how we can improve this post?