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

Tabs : error javascript on refresh #289

Closed
zamrokk opened this issue Oct 30, 2013 · 5 comments
Closed

Tabs : error javascript on refresh #289

zamrokk opened this issue Oct 30, 2013 · 5 comments

Comments

@zamrokk
Copy link

zamrokk commented Oct 30, 2013

w2ui-1.3.js line 7267

stack :
Uncaught TypeError: Cannot read property 'id' of undefined w2ui-1.3.js:7282
w2tabs.refresh w2ui-1.3.js:7282
w2tabs.refresh w2ui-1.3.js:7261
w2tabs.render w2ui-1.3.js:7328
$j.fn.w2tabs w2ui-1.3.js:7096
(anonymous function) notifications.jsp:399
fire jquery-2.0.2.js:2939
self.fireWith jquery-2.0.2.js:3051
jQuery.extend.ready jquery-2.0.2.js:398
completed

i replaced this :

// create or refresh only one item
var tab = this.get(id);
if (tab == null) return;

by this :

// create or refresh only one item
var tab = this.get(id);
if (id == null) return;

it works fine now

i am using with prototype.js and jquery noConflict mode. I had to rename all $ on w2ui to $j. Is not a better solution for w2ui for replacing $ variable as jquery does ?

Can you send me back a comment on my fix ?

Thanks

@vitmalina
Copy link
Owner

I have tried to replicate the problem but could not. Can you see if this happens without the use of other libraries besides jQuery. About your fix, it does not seem to look correct. The parameter id can be passed as undefined and you are only checking for null. However, this.get(id) will return null or an object.

@zamrokk
Copy link
Author

zamrokk commented Oct 30, 2013

in my case, when i had the original version

var tab = this.get(id);
if (tab == null) return;

i had values : id = null and tab = undefined
it was at the end of the construction of tabulations. From #1 to #3 tabs was ok, Then it comes back to the caller of recursive loop (for (var i in this.tabs) this.refresh(this.tabs[i].id);) and javascript fails as i said.

Only rescue was to check on id==null

@vitmalina
Copy link
Owner

I still have hard time replication. Can you post code sample? Is it reproducible without other libraries?

@zamrokk
Copy link
Author

zamrokk commented Oct 31, 2013

i will try to come back to you ASAP
at the moment my PM has asked me to fix bugs on another project.

@zamrokk
Copy link
Author

zamrokk commented Nov 13, 2013

i removed prototype.js and i don't have any errors now.

Is hardly maintainable to keep prototype and jquery on same project. I made some library cleaning on same time.

@zamrokk zamrokk closed this as completed Nov 13, 2013
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

2 participants