Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

query function not defined for Select2 undefined error #1001

Open
ghost opened this issue Jan 29, 2015 · 2 comments
Open

query function not defined for Select2 undefined error #1001

ghost opened this issue Jan 29, 2015 · 2 comments

Comments

@ghost
Copy link

ghost commented Jan 29, 2015

Please read this.
https://stackoverflow.com/questions/14483348/query-function-not-defined-for-select2-undefined-error

This can be solved in TbSelect2 at line 148 in your Dev branch by adding select before the #{$id}
[code]
ob_start();
echo "jQuery('select#{$id}').select2({$options})";
foreach ($this->events as $event => $handler) {
echo ".on('{$event}', " . CJavaScript::encode($handler) . ")";
}
echo $defValue;

    Yii::app()->getClientScript()->registerScript(__CLASS__ . '#' . $this->getId(), ob_get_clean() . ';');

[/code]

This happens when multiple partials are rendered in the same view.

Keep up the very good work
Sincerely
Babak

@amrbedair
Copy link
Contributor

@bandpay how to reproduce this ... I have created a page that partially loads two views, each one contains a TbSelect2 widget ... so plz let me know how to see this error

@proreact
Copy link
Contributor

proreact commented Mar 7, 2015

Dear Amr,
This one was caused on a form with multiple Select2 and switchGroup elements and the last Select2 won't render.

It was fixed by prepending 'select' to the id of the as in "select#$id". I believe that the current version of YiiBooster contains the fix. Have a nice day :) Mvh Babak Bandpey Fra: Amr Bedair Sendt: 06-03-2015 17:05 Til: clevertech/YiiBooster Emne: Re: [YiiBooster] query function not defined for Select2 undefined error (#1001) @bandpayhttps://github.com/bandpay how to reproduce this ... I have created a page that partially loads two views, each one contains a TbSelect2 widget ... so plz let me know how to see this error Reply to this email directly or view it on GitHubhttps://github.com//issues/1001#issuecomment-77583796.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant