select2 not 'activate'

Questionsselect2 not 'activate'
genis asked 10 years ago

Hi all,
issue about developer version.

I cannot get that 'select widget' works like select2.

comparing inspected code with phpgrid_demo site reveal that my site dont load select2 features ( neither class="select2….." )
only css rules–> .ui-jqgrid-view select

(select2 css and js path files are right and loaded)

Thanks in advance.

3 Answers
Abu Ghufran answered 10 years ago

Hello,

The '$col["editoptions"]["dataInit"]' line is the main code to load select2 control in edit mode (as done in demos).
Make sure you have similar config in your code.

$col = array();
$col["title"] = "Client";
$col["name"] = "client_id";
$col["edittype"] = "select"; // render as select
$str = $g->get_dropdown_values("select distinct client_id as k, name as v from clients");
$col["editoptions"] = array("value"=>":;".$str);
…..
$col["editoptions"]["dataInit"] = "function(){ setTimeout(function(){ $('select[name=client_id]').select2({width:'80%', height:'20px', dropdownCssClass: 'ui-widget ui-jqdialog'}); },200); }";
…..
$cols[] = $col;

Lubos Vitu answered 10 years ago

Hi Abu.
When I type the code as you write here Dropdown Select2 works OK.
When I insert a row : $col["editoptions"]["onload"]["sql"]= "select kkk as k …",
I see only normal Dropdown.

How can I update the content Dropdown Select2?

Thanks
Lubos

Abu Ghufran answered 10 years ago

Emailed you sample code and latest build.

Your Answer

15 + 9 =

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

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?