Let's say I have a long page with a table (or to be correct with a set of containers that contain tables) and there is a lot of data in these tables, so that it doesn't fit into a screen and therefore it is possible to scroll the page with scrollbars.
Now I have a checkbox in each row of the table so that I can select some rows and perform some actions with them.
These checkboxes are tied to the state so that when I check one of them, the state gets updated and entire page gets re-rendered. If I understand correctly, this leads to unexpected content scrolling (jumping).
So my question is: is there any common approach to avoid this unexpected behavior? I'm thinking of separating user interactions into a separate state, but it feels like a reinventing the wheel a bit. Any other ideas or standard approaches?
#Simon_Weaver, #user2216584 your comments were correct: just need to add trackBy to prevent Angular from redrawing containers
Related
first post to StackOverflow, though I've been finding great tips for a few years here. Hope to resolve a vexing problem with handsontable.
I have an application that presents a handsontable instance with several columns whose content/format is dependent upon the value in a cell in another column. I determine the content and format of the dependent cells by way of a database query and server-side processing, the results of which are sent back to handsontable for processing in the afterChange function.
My problem is that whenever the user updates one cell in the table, ALL cells blink while the code laboriously reconsiders the formatting for ALL cells in the table. The preferred behavior would be to ONLY update the cells for which the formatting has changed, i.e., that small set which is dependent on the value that changed in the first cell. It's only these dependent cells whose contents are being changed anyway. Why redraw the WHOLE table??
I have searched and search here and elsewhere, and the closest to an answer I could find is that this is the intended behavior for the table. I don't agree...when the table is anything larger than 10 rows, the updating process is painfully slow and distracting to the user.
Any suggestions? I'm open to directly editing the handsontable js code, but would prefer to flip some flag I'm unaware of if possible.
Thanks all!
afterChange fire only one time for the cell you just updated (documentation example).
Your problem might come from an afterChange "chain reaction". The first afterChange modifies one or more related cells, triggering others afterChange and so on. If that's the problem, you can put a filter on the source parameter.
Another solution could be to work on a copy of the data to do your updates (see data binding), and once everything is fine, inject it back on the table with loadData, and ignore the loadData source in the afterChange callback.
Finally, if you still have some performance issues, you can check the performance tips, and remove any option that might slow your table (example with columnSorting)
(sorry I can't use comments to identify precisely from where your issue come...)
I have a NSBrowser that needs to display data that comes from a REST API. Sometimes this API takes a while to return results, so it would be nice to handle the network traffic in the background (lazy fetching). Sometimes a subtree needs to be refresh to reflect server side changes.
I've tried two different approaches:
Using NSBrowserDelegate. When [browserDelegate browser:child:ofItem:] or similar function ends up requesting data that is not yet loaded, I return 0 count and kick off background processing. When the data becomes available I have the columns reloaded (not very efficient, messes with the user's selection as new data comes in).
Using NSTreeController. I got this to work well using a blocking/synchronous approach. However, whenever I update the model, NSBrowser resets the tree and moves the selection up to the parent. I've tried [obj mutableArrayValueForKey] approach. I've tried the [treecontroller insertObject:atArrangedObjectIndexPath:] approach. I've toggled "preserve selections" flag. I've toggled "select on insert". No matter what I do, NSBrowser doesn't want to cleanly update only the relevant subtree.
Bottom line: what is the best practice for asynchronously loading data into an NSBrowser?
there
I found that when quickly swiping or flicking the pivot, the pivot will become very obtuse.When the finger off the screen the pivot still traslate between pivotItems a few times.
Is there any way to make the Pivot performance like the Panorama in the situation of quickly swiping or flicking.
I encountered the same problem which was due to using more than 5 tabs each with databinding on them. Each time I swerved to a new page the databinding was triggered thus causing a noticeable delay. (If you keep swirving these requests create a backfill this eventually resulting in multiple background threads for each pivot tab)
I fixed this by collapsing the data on the tabs and only revealing it when the tab was shown for more than 3 seconds. This greatly reduced the databinding and thus data loading. Inmy case though I did have to resort to this because I used the tabs as ways to navigate through dates thus I was facing a potentially limitless collection and had to cycle data across my 5 available tabs. (Microsoft recommends against using more than 5 tabs).
If you have a finite set of less than 6 tabs an easier approach would be to set data binding to ‘one time’ to populate the data. If you have items on the tabs that rely on allowing a control to not just display but also update a value you can always trigger the databinding through that controls events. (be sure to not just use the updated method but also the page.navigateaway event to trigger databinding as navigating away from a page right after updating the value of a control won’t trigger the control.updated event)
I have a form with almost 60 controls on it and the client wants all that information to be fillable on one form, because all that is related to one document. Are there some usable patterns to do that? Some ways of dealing with such problem i see:
put many controls on one page with vertical/horizontal scrolling(for example i hate scrolling, dont think that decision is suitable).
create tab pages for sections. But here is a small problem: the sections are not really there, because all information is related to one thing..Tho still i can create some sections, but must save/validate all tab pages at once.
Please suggest some common practices for such problems.
Well, my app has forms with far more than that on and so I feel your pain.
I would avoid scroll bars. It's much harder for the user to be sure that they have seen everything when you have scroll bars.
I'd recommend page controls (i.e. tabs). I'm sure if you try hard enough you'll find some sort of grouping that makes sense.
The other approach you sometimes see used which is similar to a page control is pages but with Next/Back buttons. The problem with this is that it is needlessly linear.
It's harder to advise on validation. If the validation only depends on the value of the single value in question, then validate on entry. Consider using colour highlighting rather than dialog boxes. Only show hard fail dialogs when the user tries to dismiss the dialog.
Validation for values whose validity depend on other user input is harder. I'd postpone that to dialog dismiss time.
i have a pivot control with around 20 items that are data binded to an observable collection. One of these items has a long text inside, and I think it delays a bit to data bind. when i scroll too fast and pass this item, the headers start to behave strange, the highlighted header disappears from the screen and i see the other headers. the animation of headers stops.
How can i fix this? any ideas? You can reproduce this problem on a device.
thanx
I would have though that having 20 pivot items was more likely to be the cause of the problem, rather than a long pivot title. However, from a user experience point-of-view I would suggest that 20 pivot items is not going to provide a good user experience especially as all pivot items are loaded on when the pivot is started, so performance is likely to be poor, too.
I would suggest that you consider an alternative approach. Perhaps you could use the Panorama to provide a Hub-like experience with your data grouped into different Panorama items. You could then use a Pivot on secondary pages to show group contents where appropriate.
I can't say that I've experienced this, but then I haven't found a need to use a Pivot with 20 pages.
Could it be that if you're finding the need to flick that quikly through the pages that another UX would be more appropriate?
Perhaps a listbox to present a choice of items allowing ultra smooth and fast scrolling, from which the user can choose to select an item and drill down for details.
The databound project template provides some out of the box handling to demonstrate the concept, but don't be show to roll your own in a vanilla project template.
I've experienced the same issue with a pivot control with only 4 pivot items. The animation gets screwed up when the pivot item containing a long list is selected, so I'm guessing that because pivots don't load their data until the item is selected, that the pivot control is getting screwed up trying to load the long list while animating...so it gives up on the animation.
I haven't really figured out what to do about this yet. One solution is to not bind the data in the pivot item until that item is selected. This isn't really ideal, but it would likely solve the animation issue.