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

Cannot read property 'apply' of null #1475

Closed
daN4cat opened this issue Aug 19, 2016 · 6 comments
Closed

Cannot read property 'apply' of null #1475

daN4cat opened this issue Aug 19, 2016 · 6 comments

Comments

@daN4cat
Copy link

daN4cat commented Aug 19, 2016

After upgrading from 1.10.0 to 1.11.0 the following code causes an error:

  // set data-selected on options that are programmatically selected
  // prior to initialization of bootstrap-select
  var _val = $.fn.val;
  $.fn.val = function(value){
    if (this.is('select') && value) {
      this.find('option[value="' + value + '"]').data('selected', true);
    }

    return _val.apply(this, arguments);
  };

the exception is thrown on the return line. It looks like _val is null.

What changed from 1.10.0 to 1.11.0 that could cause this error?

@daN4cat
Copy link
Author

daN4cat commented Aug 19, 2016

That piece of code went in here: 5da6694

@caseyjhol
Copy link
Member

Can you provide an example? I can't recreate this.

@daN4cat
Copy link
Author

daN4cat commented Aug 24, 2016

We had that problem in this open source: jekkos/opensourcepos@9a6bd6e and I reverted the version to 1.10 to avoid issues.
As soon as I updated your plugin to 1.11 I got bug reports, see https://github.com/jekkos/opensourcepos/issues/813 and https://github.com/jekkos/opensourcepos/issues/812

Unfortunately I don't have the time to create a specific example, but OSPOS source is quite mature and ready to be delivered. It worked well for many months of development with your version 1.10.

@kenbwhite
Copy link

kenbwhite commented Aug 25, 2016

@caseyjhol I was having the same problem and we rolled back to v1.10.0 and everything worked fine. Here is a link to a codeply that causes the problem.

http://codeply.com/go/y8gEFpNvbz

To see the problem please do the following:

  1. Click on Magnifying class
  2. Type in J in the text box that just displayed (In the console, you will see the error)

If you roll back to an older version of bootstrap-select you will see the autocomplete run correctly.

I hope this helps, if not let me know and I'll try and update with some more.

Ken

@caseyjhol
Copy link
Member

Great - thanks, Ken. Will look into this.

@daN4cat
Copy link
Author

daN4cat commented Aug 25, 2016

Yes, we get the same issue with an autocomplete box.

avantika-gupta-jtg pushed a commit to JoshLabs/bootstrap-select that referenced this issue May 14, 2020
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

3 participants