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

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.

Related

CRM 2013/2015/2016 subgrid popout, retain fetchxml query

I have a subgrid on my form which I assign a dynamically generated fetchxml query using javascript. When the user clicks on the subgrid's "pop out" button, the query is lost and it displays the default view for that entity.
The user needs to be able to perform multi selection and bulk editing. As far as I know this is not possible for subgrids in CRM 2013 upwards. Is there a way to retain the query when it is popped out?
There's no supported way to interact with a popped out grid. If you started digging into the client side application code, you might be able to find a hook to the new window, but doing so would be unsupported, liable to break, and I wouldn't recommend it.
I was going to suggest hiding that pop-out button on your entity's sub-grid altogether before re-reading that your users need to use the popped out grid for bulk edit.
In that case your best option will be to do ditch the JS and move to a RetrieveMultiple plugin against the sub-entity. RetrieveMultiple plugins should be generally avoided, but from what it sounds like in your case, it's your only option.
And, just to be thorough, are you positive you need dynamic fetch for the sub-grid? Is there any way you could come up with a view that would get close enough to your requirement, even if it's not perfect?
Update:
Based on the additional information you provided in your comment, I can only think of two options:
Implement a custom grid--or modify one of the free ones out there--that allows multi-select and bulk edit
Your custom web app takes the user's criteria, creates a personal view (entity: userquery) for the user and saves it to the database, then your JS on the form sets the grid to that view.
You can do that liks this:
document.getElementById("someGridId").control.SetParameter("viewtype", "4230"); // 4230 is the objecttypecode for userquery
document.getElementById("someGridId").control.SetParameter("viewid", "{11310965-0306-E611-80E5-3863BB36DD08}");
Doing this actually does make the popped out grid load the personal view, but in my tests just now the grid gets upset if you try to refresh it.
This approach has obvious downsides: 1) You have to come up with a way to clean up the personal views that get generated 2) the grid might break on refresh 3) it's unsupported and liable to break on an update.
Still worth considering, I suppose.
A more supported way instead of using unsupported getElementById is to hook a plugin to multiple retrieve of the entity and amend the query in there
Chris

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.

jquery serialize returning incorrect values after previous async page update

Let me try and explain the scenario:
I have a form with multiple items in it. The form is multi-functional so it has multiple submit buttons that are handled on the server correctly.
A single item can be deleted (one submit button per item) and also all items can be saved (a submit button at the bottom of the form).
When an item is deleted a $.post is used and the DIV containing the form is updated with the new response using
$("#containingDIV").html(response)
therefore omitting the deleted item creating a new form.
If I subsequently hit the Save All button and call to
$(form).serialize();
serializes the correct number of items but it includes the item that was deleted and misses the last item in the form.
I can't get my head around why this is happening but I'm no jQuery guru so hoping someone can shed some light on this.
Any help is much appreciated.
Thanks,
Tom.
Thanks everyone for helping. I've just worked out what is going on and it's to do with ASP.NET MVC framework not jQuery. I inspected the response being returned and noticed that all the inputs contained the same item id's as they did prior to the delete. a call to ModelState.Clear() solved the problem for me. Arrrgghh! :D

jqgrid click local data column sort (client-side only) wipes userData on grid refresh

I have a grid that is populated by a JSON response (MVC3 controller) that has a userData component for some additional data for grid captions, etc. All that works just fine. I recently switched the the grid's data loading to "loadonce: true" as in working with larger grid results sets, I wanted client-side sorting and filtering. All that works good. BUT, I was surprised that the userData got wiped the first time I clicked any column for sorting. If I turn off loadonce, userData is fine, but it is of course going back to the server each time. The items that make use of the userData fire on gridcomplete and are now coming back "undefined" after a sort (and probably anything that reloads the grid). Any thoughts why this might be happening? Oh yeah, I also noticed that clicking a column sort wiped out any multiselections (perhaps related to the same culprit?).
Thanks,
Mark
You are right. +1 from me. It's a jqGrid bug. Inside of internal addLocalData method after the line 1527 of the file grid.base.js of jqGrid 4.1.2 or after the 1532 of jquery.jqGrid.src.js (you can get modified version from here) one should add the following line
retresult[ts.p.localReader.userdata] = ts.p.userData;
It will fix the problem. I posted the corresponding bug report here.

Update a controls viewstate on an AJAX callback

I update a rad combo control using telerik calllback method described here
The items in the list are changed on the callback and I want to maintain this filtered list after the postback.
Is it possible to update the viewstate in the server side method? I think if I can access this i can then update both my list of items on the client and the server.. allow my drop down list to survive a postback
Any help appreciated
littleschris, you do not need to update the combobox viewstate but rather to store it selected value and then recover it after postback. Hope my explanation is useful.
Dick

Resources