-
-
Notifications
You must be signed in to change notification settings - Fork 195
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
Treeview - child nodes #1126
Comments
Hi, not sure, if it´s connected-but I have just found kind of strange behavior of Tree View. I have Status switch on every line - in root level, everything works, if I open children level and use the status switch, it looses connection to Presenter (I have grid in ocmponent), it runs the "statusChange" callback, but in it, I can´t check working Ajax. I have switchStatus method in baseGrid class (I have tons of grids and statusSwitch is always the same), but in few special cases, I´m overloading that general function, calling parent and adding some stuff after the base function and it won´t run that code as page reloads instead of redrawing single line via Ajax. It kind of seems like your problem is the same - instead of Ajax opening, your page reloads and everything is packed again. No idea tho...if problem is on our side, or on datagrid side. Could be easilly wrong implementation. Tree view demo on: |
@MikKuba so, I´ve searched a bit more and found out updating Naja1 to Naja2 and adding this fix #1035 to datagrid.js fixes my issue with Ajax. dataGridLoad = function () {
naja.load();
}; to: dataGridLoad = function () {
if (isNaja2()) {
document.querySelectorAll('.datagrid .ajax').forEach((element) => {
naja.uiHandler.bindUI(element);
});
} else {
naja.load();
}
}; |
Hey @darkWolf-PR, I am not sure what you mean, can you open PR please? |
@f3l1x What you mean exactly? @MikKuba did not said which JS library is he using. I´ve found that the problem I´ve had with datagrid reloading whole page within TreeView instead of using ajax (which seems to be the same issue as he had) was connected to support of Naja 1 library (I had Naja 1.8.3) in Datagrid. After checking other issues and pulls, I´ve found the one I´ve tried to link that suggests similar problem with Naja2 and fix for that, so I had nothing to loose, switched to latest Naja and added suggested change to datagrid.js. That fixed me the reloading problem. So I guess it´s something related to released datagrid version and used Naja 1 version. I have no idea what, because I do not understand this JS at all... Switching status in child node misses these two lines in ajax request(these are from root node status switch), no idea why: Btw - that not working demo(tree view part) is already using the new version 7? As there is BS5 in assets. It´s impossible to open child rows there. |
Oh, I see now. I will try to fix demo. :-) |
I have problem with child nodes in treeview.
This is how I set dataSource - result is array, because example does not work good with Doctrine. IMO array is OK.
And functions for creating tree:
And callback for nodes with children:
Now the problem, what's wrong.
When I open first level node (meaning from root to first level), every child nodes appear correctly. But, if this node has another children and I try to show them, page reload and all nodes are packed up.
And also - when I successfully opened first level from root, same issue is when i want to click edit on this child node.
Do you have any idea, what's wrong with my code, or is it some issue of this library?
Thanks a lot for any suggestions!
The text was updated successfully, but these errors were encountered: