Vaadin 10 TreeGrid.refreshItem refrehes only after mouse click - treeview

I use a TreeGrid in Vaadin 10.
This is the way I set the data for the treeGrid:
treeGrid.setItems( customers, Dataline::getChildren );
When data is changed, I call
treeGrid.getDataProvider().refreshItem( line );
This updates the table only when I do a click a different element in the table.
If I do not click a different element, nothing happens.
What's the proper way to update data ?
Thanks for any help!
Thorsten

How does update happen? Is it from background thread?
If it so, you should use push Server push configuration to update the UI when new data is available.
Because it looks like update is happening only on the next server request (when you perform some action)
At least, the code you are using looks good and should work otherwise.

Related

Oracle Apex 5.1 Interactive grid save issue

I have an interactive grid that intermittently fails to save changed data properly.
I have a changed the default save process into a PL/SQL process to allow me to do some lookups before the data is saved back to the table. I have some PL/SQL logging in the save procedure, so I can see when the process starts & ends and what a number of the variable values are.
This process works fine, most of the time. However every now and again 1 in 20 or so, the process fires but I can see that one of the new values is actually the old value, so the update works with the wrong data. I can not see any pattern to how I'm updating the cell when it doesn't work.
I have created a button with a dynamic action to Submit the page on button click, which fires the update whenever a change is made. I also have a branch on the button at "After Processing".
I'm not sure the branch is relevant as I can see that the save procedure fires before it's redirected, but sometimes without using the updated values.
Any ideas or suggestions on how to track down my issue?
Cheers
Pav
The debug didn't show anything. However I believe I found the cause.
The page had some javascript lifted from the IG Cookbook to calculate a column total.
When I removed one command it stopped the issue. I also tracked the issue to a model change that wasn't saved, then navigated off page and then back. Then the first changed made and saved would save original value and not the changed value.
Code removed was:
// just in case fetch all the data. Model notifications will
// cause calls to update so nothing to do in the callback function.
// can remove if data will always be less than 50 records
model.fetchAll(function() {});
Cheers
Pav

Issue with Kendo MVVM Cascading drop down

I am working on developing a cascading drop down with Kendo MVVM. The issue is that when the drop down loads the child drop down initially displays "undefined". This disappears though when I select some data in the parent drop down.
Alternatively I also require a Reset button in place. On click of this button I need to reset the cascade so that we get back to the initial phase(i.e. the child drop down should be disabled and no data should be selected in the parent).
Please find a JSBin that I created for the issue here
Thanks in advance for the help.
You should be using IDs as values, not strings. I think you can play around with data-primitive-value but why? Just use proper structure to begin with. For the clear, just dropdownlist.select(0) or dropdownlist.select("") if you managed to make it work with the primitive value thing.
http://dojo.telerik.com/ePIDO

Bug in Kendo DropDownList release 2015.1.318

've just tried giving the latest release of Kendo UI a spin, but it seems something has broken when using a DropDownList in a custom popup editor.
If the dataSource of the DropDownList is set to a JavaScript array or object, the selected value does not update the Grid model.
DropDownLists that have a remote dataSource with dataTextField and dataValueField configured are working okay.
Basically, code that worked perfectly with the 2014.3.1316 release is not working with the 2015.1.318 release (no errors are reported in Chrome's console).
Can somebody please confirm that this is a bug with the new release, or is there something else I need to be aware of?
EDIT: This is seems to be affecting all DropDownLists. The selected item is not updating the model immediately -- only when the record is saved.
I've knocked together a simple Fiddle to demonstrate the issue. With the previous version, selecting an item updates the Grid's model immediately and set's dirty to true. With the new version, the Grid's model isn't updated (at least not immediately).
The described issue is a known bug in Q1 2015 - BUG 623.
It is addressed in the latest internal builds and the upcoming service pack, that will be released till the end of week, will include the fix (and many more)
I am afraid that there is no simple workaround, as the widget just sets its "_old" value to the new one on first select. Hence the change event will not be raised. The only feasible solution is to upgrade to a newer version of Kendo UI.
When it comes to the dropdownlist and multiselect controls they have changed a lot to allow the new grouping and virtualization features to work. (having been a victim of this change as well - I'm still trying to fix my code at the minute)
I have updated your fiddle with a possible solution for what you want to achieve Update with Change Event added
I have basically added this function for you:
function changeCategory(e)
{
$('#log2').text('This should be the ID of the category you changed too: '+
e.sender.value());
}
but for more information on this change you can look here:
Changes to Kendo UI Q1 2015
EDIT:
Also if my memory is correct I think the select event is fired before the change event so that will always show the previous value and not the new value that has been selected and when you click update the grid is updating as expected from what I can see.
just try to specify a defaultValue in your schema model definition to CategoryID, i think this would be a better solution, couse this bug occurs only when the value is empty
The Changes to Kendo UI Q1 2015 page doesn't directly mention the change in behavior described, but it's likely to be caused by the substantial changes to the DropDownList widget.
There's a pretty simple workaround, but I suspect it shouldn't be necessary and will be 'fixed' at some point.
To emulate the old behavior you just need to manually set the model field that's supposed to be updated immediately. So in the select event add something like...
model.set('CategoryID', dataItem.CategoryID);
Updated Fiddle. Without doing this, any dependent methods will use the original or old value, which is simply not right (hence, I suspect it'll be fixed).
I also experienced the problem with dropdown lists with the 2015.1.318 release.
In the latest release, 2015.1.327, this seems to be fixed.

Kendo Grid: Clearing filter without calling server side read of data

I have a kendo grid with server side paging. On the same page, I also have a clear button which should clear the data of the grid and replace it with blank rows. Is it possible to clear the filters of that grid, without calling the server side read? Currently when I do this, $("#grid").data("kendoGrid").dataSource.filter({}), it will call the server side function and load the data. Anyone can point me to the right direction? Thanks.
Despite serverFiltering set to false by default, it seems that filter() automatically calls transport read every single time.
However, you can try this:
dataSource._filter = null;
This will cancel any filters applied to the dataSource without calling transport read. But, you have to be cautious with this approach as it isn't an "official" configuration documented by Telerik. The property _filter is internal, so to speak.
You can verify this works by console logging the requestEnd event and seeing that this doesn't make a request.

Telerik RadCombobox not keeping state when using client side requestItems() to load

I'm using the Telerik RadComboBox control. I have two related combos and when the user selects a value in the first one I filter the second one.
I use the code below to achieve this:
localeCombo = $find("<%= ddlLocale.ClientID %>");
localeCombo.requestItems(item.get_value(), false);
This works totally fine, but when I do a postback my filtered combo resets to the original non filtered list, although all other controls retain their state. I assume this is because the server side list of items is not being updated when I use the client side callback requestItems() function.
Is this the case? Is there a simple way around this?
Any help would be much appreciated!
Thanks
Chris
Yep, most probably your suggestion is true. You may try keeping the second filtered combo value in session or cache storage and then restore it from there on postback - at least this is what I would do.
This is a bug with RadComboBox. I opened a ticket.

Resources