I have created a custom control which I am using multiple times on the page.
I checked value at the Loaded event.
Due to long delay of data retrieval, I am not able to check value at the control loaded event.
Now I need to reload the control after data retrieval from the WCF service.
Can you please suggest me the right approach to do the same.
Thank you.
If you are using Silverlight to call a WCF service to get your data, you will be working Asynchronous right?
You could hook up the completed event of your webservice call to do anything (like reloading, rebinding your controls) you want after the data has been retrieved from your WCF service.
It would be better if you could set up binding to your custom control. Whenever the observable data is retrieved and assigned to your binding object, your control will be updated.
Related
I'm building a Windows 8 Store app in HTML/JS which uses GeoNames & Mediawiki/Wikipedia APIs.
JSON Data from the GeoNames API is populated into a Listview. Oddly, the content in the listview refreshes on its own?
Does anyone have any pointers on what could be wrong?
This refresh happens once every minute. While I'm on any other item in the ListView than the first, the refresh forces back the focus to the very first item in the list view.
I'm using the Geolocator PositionChanged event. I've not set any value explicitly to the ReportInterval property of the Geolocator class.
This is because you have some code that is setting the itemDataSource on the ListView -- is this not because you have some long poll function that is completing, and setting the data again and again?
Can anyone tell me how to connect my dojo datagrid to "onApplyCellEdit" event and how to update the dojo store with the updated values in the grid. thanks.
if youre using a store which implements dojo.data.api.Write (like ItemFileWriteStore or such), then your store will handle this by default, once it is connected to a datagrid.
When youre done editing (or do it on cell.onblur or like) check if any changes was made to store by calling store.isDirty(). If it returns true, either a new, modified or deleted item is not in sync with server.
To sync, look into the api.Write and see that for every store there is a call .save() - which ofc you must implement (unless you leverage REST with PUT/DELETE/POST pattern)
I'm creating a TabPanel component where the specific tabs are created/defined by user configuration.
So far, I've taken the approach of just using a stateful component to keep the users preferences of which tabs to show and been using the simple Ext.state.LocalStorageProvider to keep the users preferences.
But I actually ultimately want to store the user preferences/config in my database, so I created my own StateProvider that will store/load the prefs via AJAX calls.
The problem I've encountered is that my tab panel is loaded far sooner than the AJAX calls inside my StateProvider return, so what I need is some way to do a synchronous ajax call (which I know is morally wrong) or to somehow delay my tab panel from rendering until the preferences in my state provider are finished loading.
Anyone had a similar issue? It might be as simple as sleeping one thread for a while, but I know that's not nice either.
I think this is a bit old, but as I have found a similar problem...
Instead of sleeping, you can load the tab panel on the listener of your StateProvider ajax calls. So when your call returns, the tab will still not be loaded.
I have JQGrid loading data from WCF OperationContract with paging and sorting working fine. I am using "multiselect: true" so that I get the checkbox column and ability to select multiple rows. I've implemented gridComplete:, onSelectAll: and onSelectRow: to capture when checkboxes are checked/unchecked and to maintain checked state upon pagination. I am able to save the checkbox state to the DB via another WCF method call.
What I cannot figure out how to do is load the saved checkbox state for each row along with the other fields specified in colModel:.
Any ideas? I realize I can make a separate WCF service call to get the values, loop through them and set state manually, but that seems like a huge waste and overly clunky.
Thanks in advance.
The simplest way, which I imagine me immediately after reading of your question, is to have additional hidden column (hidden: true property in the colModel for the column) and the checkboxes inside. You can load the selection state from the database an fill the hidden checkboxes. Inside of loadComplete or gridComplete you can use the information to select the rows.
If you would use loadComplete instead of gridComplete you can even eliminate the need to hold hidden row. The callback method loadComplete has data parameter which are initialized with the data originated from the ajax call. So if your server response contain more information as jqGrid need the data will be ignored by jqGrid, but you can see the data in the loadComplete and use the information to set row selection.
I have inherited some Silverlight\WCF code and now need to implement some new features. I fairly new to Silverlight\WCF so my question may be rather basic. So...
I have a listbox in Silverlight that binds to a resource that is a List<> returned from a WCF (rest) service (which is just reading values from a db table). I have implemented the ability to add new items to the db table through a WCF service and now want to make my listbox update once it has been added to the db.
It is possible that my initial code needs to change so I have listed the relevant lines below.
In xaml the resource is as such:
<CollectionViewSource x:Key="myWCFSvc">
<CollectionViewSource.SortDescriptions>
<scm:SortDescription Direction="Ascending" PropertyName="ID" />
</CollectionViewSource.SortDescriptions>
</CollectionViewSource>
And the binding of the listbox is:
ItemsSource="{Binding Source={StaticResource myWCFSvc}}
And the .cs has in the callback
((CollectionViewSource)LayoutRoot.Resources["WCFSvc"]).Source = myList;
So now if a user adds a new entry through another Silverlight childwindow an new entry is created in the db and I want to update the listbox to include this entry. I'm unclear how to do this.
I know there are observablecollections and INotifyPropertyChanged but unsure if this is those are what I need, or how to use them in this context. I searched around a bit but the examples I found don't seem fit my scenario.
Your original thoughts are correct, the type you are looking for is the ObservableCollection<T>.
If you replace your existing List with this then as changes are made to its membership by other code it will notify other interested parties such as the CollectionViewSource, which in turn will notify anyting that is binding to it.