-
Notifications
You must be signed in to change notification settings - Fork 26
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
Fix save event for custom groups on first navigation #101
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some code needs to be optimized
event_fn(_id); | ||
if ($(_id + " form").length > 0) { | ||
clearInterval(btn_set); | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The else
statement may not be necessary
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it always needs to be executed. It also clear the interval when the form is found.
}); | ||
|
||
if (location.hash) { | ||
var index = location.hash.substring(1); | ||
$("#SettingManagementWrapper li.nav-item > a.nav-link")[index].click(); | ||
history.replaceState(null, null, ' '); // remove hash from the location url | ||
} | ||
|
||
// The first nav will automatically click and loading before on this script. | ||
bind_nav_event_fn($("#SettingManagementWrapper li.nav-item > a.nav-link").first()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may be better understood to use $('#tabs-nav .nav-item .nav-link')
here
var btn_set = setInterval(function () { | ||
var _id = '#' + _this.data('id') + " "; | ||
var _id = '#' + element.data('id') + " "; | ||
event_fn(_id); | ||
if ($(_id + " form").length > 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When no form exists, we can consider skipping the next steps.
if ($(_id + " form").length == 0) return
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If form is not setting ui's form. We also need to clear the interval.
var btn_set = setInterval(function () { | ||
var _id = '#' + _this.data('id') + " "; | ||
var _id = '#' + element.data('id') + " "; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a legacy here, when we click FeatureManagement Tab $(_id + " form").length
It's always 0,
So the value of id should bevar _id = '#' + element.data('id').replace(/\./g, '-') + " ";
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix #100