-
Notifications
You must be signed in to change notification settings - Fork 251
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
Bug: Sparse dir listing on tree collapse #104
Comments
PR with fix submitted. (This PR is in a clean branch from Thanks! |
Good catch, thanks for the report and PR. I will review it soon. |
Please note, part of this PR includes updating the (hard-coded) (IMHO, Thanks! |
|
I tested it with I noticed a pleasant UX change. It used to be that clicking on either the dir name, or the minus-sign button to the left of it, would cause the expanded dir to collapse. But now clicking the dir name just reloads the dir, and does not collapse it. That feels more natural to me. "Click-to-refresh" is all the user needs to remember. Thanks for this change! As an aside, I was thinking it might be possible to reduce the number of lines of code in It has a polished UX, lazy loading, theme support, multi-select, good docs, MIT license, and a plugin community -- including a plugin for mobile devices. I think the tree widget in RichFilemanager is elegant and well done, but JSTree might look even better, while providing additional features and fewer lines of code and CSS to maintain. I believe updating to this library would require replacing much of the TreeModel and TreeNodeModel code with registered event callback functions, using the config API used by JSTree. The user interface logic could be removed, but the core AJAX event callbacks for updating the ItemsModel() would remain the same. Would you be interested in seeing an integration of JSTree in RichFilemanager? I'd be willing to take a crack at it, if there is interest. |
Hi @dereks I used some of tree plugins before, but came to the current solution. All of the plugins have limitations and not flexible as much as it's required. Each one that I have tested is perfect at first sight, but later you are facing with a lot of problems. Lazy load will be implemented in one of the next releases. Some ideas I will get from #99, #101 PRs, which are suggested by @Iworb, but the final implementation will differ. At the moment I'm working to adapt you markdown feature PR to the different configuration cases and fixing bugs. It have brought a lot of troubles ) |
Thanks for working on it! I am happy to help fix any bugs caused by the Markdown feature, just let me know. (But I understand that writing up a bug in a GitHub Issue is sometimes more work than just fixing the bug yourself.)
Hmm, very interesting. This is different from my experience. Could you tell me some of the problems you encountered? I just started playing around with an experimental jsTree branch. I'm hoping I can get it to render, just to see what it looks like. The list of supported jsTree events is very extensive (before_open, open, after_open, etc.): |
This one was the last: It has a very wide API, but there were some issues, that I wasn't able to handle. Unfortunately I don't remember which ones. Also I don't remember a previous tree plugin that I tested. New experience is nice, so keep playing with jsTree. I expect for the feedback. But keep in mind that there are a lot of various cases for RichFilemanager based on the configuration options. |
If using
config.listFiles
set tofalse
, which enables showing just sub-directories in the tree, there is a weird UX error.When you click on a dir in the tree, to expand it and show its contents, everything works as expected. All files are shown in the detail pane, but only dirs are shown in the tree.
But if you click the dir in the tree again, to collapse the (expanded) node, there is a bug where the detail pane suddenly shows only the sub-dirs. The files are suddenly hidden.
The error is in this function:
When
openNode()
is called the second time (after the node has been expanded),node.isLoaded()
is true, and it falls to re-using the previously loaded children withmodel.itemsModel.setList(childrenObjects);
But thanks toconfig.listFiles
only the sub-dirs are present inchildrenObjects
. This causes the detail pane to suddenly show only the sub-dirs, when all the user wanted to do was collapse the tree element.My first attempt at a fix fell back to doing an AJAX load of dir contents everytime, regardless of whether it was previously expanded or not. That fixes the symptom described above.
But after playing around with the tree for a while, I feel strongly that it's much more intuitive if collapsing the node doesn't change the detail pane at all (i.e., collapsing a dir does not changeDir into that dir). It should just be a passive "collapse this dir node -- I'm done with it", rather than a "collapse this dir node, but also switch to it in the detail pane".
So I will submit a PR with this fix shortly. It will fix the bug but also change the behavior so that collapsing a dir node does not show that dir's contents -- the user is now able to collapse tree nodes but stay with their current detail view.
Thanks!
The text was updated successfully, but these errors were encountered: