I have googled, searched forums and stack exchange but nothing seems to work for me. I am running extJS 3.2.1.
Basically I have a gridpanel control which has items that are greyed out as they are completed but the vertical view pane is only about 200 px while the list can grow quite large leaving users to scroll down each time I do a store.reload()
I have discovered I can manually move the next item in the list by calling:
grid.getView().getRow(15).scrollIntoView();
I cannot use selectRow() because I have enabled the checkboxes instead of row selection.
Anyway the above code works great only I cannot determine "where" to call it. I have tried capturing the store.load event as well as the grid.afterrender and neither seem to work.
Any ideas?
If you go to the source of store.reload(); you can see it calls the the load method.
http://docs.sencha.com/ext-js/3-4/source/Store.html#Ext-data-Store-method-reload
So you really should be hooking the load event.
Something like
store.on('load',function(){
grid.getView().getRow(15).scrollIntoView();
})
http://docs.sencha.com/ext-js/3-4/#!/api/Ext.grid.CellSelectionModel-method-select
is the cell selection model equivalent btw ( of row select ).
Related
I have a radgridview with a GridViewToggleRowDetailsColumn and I can set the visibility of the GridViewToggleButton the way I want through the RowLoaded event for each row. It was working fine until I need to scroll horizontally. When the GridViewToggleRowDetailsColumn get out of the screen and I scroll back to it, the GridViewToggleButton are now all visible.
I tried to find any event triggered by this without success. Even the IsVisibleChanged event attached to the GridViewToggleButton seems to be triggered only on the visible one.
Does anyone faced the same issue or have any idea of what could produce this behavior ?
Edit: Found the answer. It was a virtualization issue. Adding EnableColumnVirtualization="False" in the gridview properties solved it.
https://docs.telerik.com/devtools/wpf/controls/radgridview/features/ui-virtualization
After a few minutes of research, it appears that telerik WPF GridView uses virtualization to improve performace. This means that the state of what is in the screen is retained and as things leave your viewing area they are destroyed. This frees up memory space significantly, however can have some side effects as you are experiencing.
You can set EnableColumnVirtualization=false however Telerik has provided a help article that will likely answer your question more directly while not sacrificing the performance provided by the virtualizations. A link is below and following through the steps, it looks fairly straightforward.
https://docs.telerik.com/devtools/wpf/controls/radgridview/style-selectors/cell-style-selector
The recommended approach for customizing this behavior, and not turning off the virtualization, is to use a custom column. Try inheriting from GridViewToggleRowDetailsColumn and override CreateCellElement. It is the callback for creating the visual element in the cell, which is called, more or less, at the same time as RowLoaded. Then return null for those rows that you don't want to have a button for.
I am using the normal WPF DataGrid to display some data from a REST feed. The REST feed is paged with a next link that contains the URL for the next set of items. The DataGrid is virtualised by having a custom object that implements the IList interface (not IList), and knows how to fetch missing data from the REST feed.
The issue is that if a user scrolls immediately to the bottom this component must do a bunch of REST requests for each "next" page, causing the GUI to freeze. Of course I could simply put up a "wait" screen, but I would actually be able to show an accurate progress bar.
So to accomplish this I have a progress bar on my application status bar that has visibility set to IsLoading on the data context, which in turn passes this down to the paging object. There is another property LoadedPercentage which shows how much of the required data has been loaded.
The issue is that when I scroll to the end of the screen, it still freezes and shows nothing. I set breakpoints in the code to see if my properties were being accessed and they were all hit at the correct times and showed the correct values. So I deduce from this that the DataGrid itself is somehow stopping the GUI thread from doing any drawing while it waits for the IList object to return the requested object.
So does anyone know of a solution for getting the status bar to show up? I would really rather have the status bar appear and track progress rather than some "loading please wait" screen. Can this be done at all with the built in objects or do we have to purchase some third party grid?
EDIT: It wasn't completely clear to some so I wanted to mention: I am doing virtualisation as described here among other places. It seems that when the DataGrid requests a specific entry it blocks the entire UI painting until it the request completes.
Well, UI is busy fetching data from the REST service. If you don't like the behaviour, you can implement data virtualization.
This post explains more: WPF Datagrid: Lazy Loading / Inifinite scroll
As far I know, there is no "ready" solution in WPF, and it will be little hassle, but it should work with some tweaking.
Implementing your custom IList doesn't sound like it would work, so I am not sure about how to "fix" your solution, and if it's even possible.
Currently I am stuck with a problem that is simple on the first sight. Its about automated GUI testing.
I want to make a row/cell of a WPF DatGrid completely visible by scrolling using ScrollIntoView(row) and then accessing the row/cell directly after. Unfortunately scrolling in ScrollViewer seems to happen asynchronously. This means I need to wait for the scrolling to finish before accessing the row/cell. For this purpose I found the ScrollChanged event I can subscribe.
There is only one detail I can not solve: If the row/cell I want to access is already visible (and no scrolling is necessary) I do not get that event and the algorithm gets stuck. I was not able to find a reliable way to predict if a call to ScrollIntoView(row) actually scrolls.
Any idea how to solve this?
To make sure layout is updated call UIElement.UpdateLayout after you ScrollIntoView and before you want to use item. Quoting MSDN it
Ensures that all visual child elements of this element are properly updated for layout.
I have a FlowDocumentPageViewer control that I am populating from the code behind. I am adding text from 3-4 items. I need to know on what page item 1,2,3... ends.
These items get added to a FlowDocument in a loop and then at the end I have
flowDocumentPageViewer.Document = resultsDocument;
However, even then if I call
flowDocumentPageViewer.PageCount
I still get 0. If I do some event like a click and print the above PageCount after the window renders, it does print the correct value. However, I need a running total of this value as I populate the FlowDocument. I am hoping someone knows some kind of trick with text metrics or any other way that this could be solved.
You have no choice but to trigger a (virtual) render of your control to get this kind of info.
the easiest way is to force a updateLayout() on the FlowDocumentPageViewer, but this means it'll show the result before you get the info which is probably not what you want.
you can also use the Arrange() method if you don't want the content to be shown:
http://msdn.microsoft.com/en-us/library/system.windows.uielement.arrange.aspx
after using this on your control you should get the updated info.
I had the same problem and to be honest I still do. Any updateLayout() did not help. Now I use a timer to get the pagecount a second later after I assigend to document to the viewer. Works fine.
I'm thinking of CTR-Clicking each item to build up an array to add.... or even more fancy, drag select an area of items (don't think this is possible tho).
I'm aware of the custom events such as ItemDoubleClicked, but is there something like ItemSingleClick, where I can check if the CTR/SHIFT key is being pressed before executing an action.
I guess there is no possible way to customise the pivot since it is not open source... and the only method I can use is the doubleClick (plus match a keyboard key)...
I don't even like the way it zooms in right away after single clicking on an item.
I'm still open to suggestions (who knows... the pivot will probably still evolve), but otherwise, this thread I'm closing.