RE: [flexcoders] dataprovider question
This is the sort of problem LCDS and BlazeDS are intended to handle - so that connected clients get informed of changes to data. You'll have to study up on their capabilities and how to employ them. Jeff -Original Message- From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of [p e r c e p t i c o n] Sent: Tuesday, May 20, 2008 12:46 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] dataprovider question Hi Folks, I'm wondering how to force a datagrid to update it's contents when a value on a server changes...do i have to query the server every time? or is there some other way of refreshing this data...shouldn't it update as soon as the data on the server changes? thanks p
Re: [flexcoders] dataProvider question
Thank you, Karl!! you've pointed me to the right direction. Turns out I was doing 2 thins wrong. first off, even though the MyDataList was marked as [Bindable] *inside* my component, it also wanted the [Bindable] tag when i actually defined a reference to the component! ([Bindable] public var mycomponent:MyComponentClassName) second, i initially avoided curly brackets because i thought flex will have problem with the variable being null (it gets initialized later on). turns out flex doesn't care!! it updates stuff when the data actually appears. so i'm all good! Thank you!!! P.S. as a side note, i really gotta go through the whole flex2 developer's guide... this was on page like 10xx of 1200, so... thanks guys! On 2/22/07, Karl Johnson [EMAIL PROTECTED] wrote: Unless you have something that is preventing you from actually binding in mxml, you should just add dataProvider={mycomponent.MyDataList} as a property in the mx:List component. If you want to setup the bind in actionscript, you can use BindingUtils.bindProperty. http://livedocs.adobe.com/flex/2/docs/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Partsfile=1043.html Karl Cynergy -- *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On Behalf Of *Andrey *Sent:* Thursday, February 22, 2007 8:55 PM *To:* flexcoders@yahoogroups.com *Subject:* Re: [flexcoders] dataProvider question Sure! my list is defined as follows: mx:List id=lstData width=100% height=100% labelField=@name /mx:List In my component (well, class) i have the following variable: [Bindable] public var MyDataList:XMLList = new XMLList(); then when the application loads and i get the instance of the component, i call the following: lstData.dataProvider = mycomponent.MyDataList; everything looks ok so far, right? then then when i receive a proper xml, i update it all inside the component: MyDataList = new XML(myxmlstring).children(); theoretically the lstData should somehow receive notification that the dataProvider has been updated and refresh itself, right? this doesn't seem to work. Since this doesn't seem to work we're reserved to throwing events from the component to the list and rebinding the list when that event is caught by the gui, but the whole thing is pretty cumbersome and i think this should work automatically what are we doing wrong? Thank you! On 2/22/07, Igor Costa [EMAIL PROTECTED] wrote: It would be nice to see your part of you code to see what you are doing wrong. Regards. On 2/22/07, darvon4u [EMAIL PROTECTED] wrote: Here is an interesting one, not sure if i'm missing something or what. I have a list to show some data. I also have a component with an xmllist property which is marked as [Bindable] in actionscript, i instantiate that component and bind this data property to the list. When i receive data from webservice, i update the xmllist of the component. shouldn't the visual list update as well since it is bound to that component's property? also, i have tried this with an XMLListCollection as well and same result. only if i rebind the list to the component's property do i get the result. what i am doing wrong? is this by design? should there be something else wired or triggered for the updates to occur automatically? thank you in advance if anybody can help in any way, -A -- Igor Costa www.igorcosta.org www.igorcosta.com skype: igorpcosta
RE: [flexcoders] dataProvider question
You do need to use XMLListCollection to get the ui update. XMLList is ike Array, and does not dispatch the necessary events. Either of the collections, or XML will. Tracy From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Andrey Sent: Thursday, February 22, 2007 8:55 PM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] dataProvider question Sure! my list is defined as follows: mx:List id=lstData width=100% height=100% labelField=@name /mx:List In my component (well, class) i have the following variable: [Bindable] public var MyDataList:XMLList = new XMLList(); then when the application loads and i get the instance of the component, i call the following: lstData.dataProvider = mycomponent.MyDataList; everything looks ok so far, right? then then when i receive a proper xml, i update it all inside the component: MyDataList = new XML(myxmlstring).children(); theoretically the lstData should somehow receive notification that the dataProvider has been updated and refresh itself, right? this doesn't seem to work. Since this doesn't seem to work we're reserved to throwing events from the component to the list and rebinding the list when that event is caught by the gui, but the whole thing is pretty cumbersome and i think this should work automatically what are we doing wrong? Thank you! On 2/22/07, Igor Costa [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: It would be nice to see your part of you code to see what you are doing wrong. Regards. On 2/22/07, darvon4u [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Here is an interesting one, not sure if i'm missing something or what. I have a list to show some data. I also have a component with an xmllist property which is marked as [Bindable] in actionscript, i instantiate that component and bind this data property to the list. When i receive data from webservice, i update the xmllist of the component. shouldn't the visual list update as well since it is bound to that component's property? also, i have tried this with an XMLListCollection as well and same result. only if i rebind the list to the component's property do i get the result. what i am doing wrong? is this by design? should there be something else wired or triggered for the updates to occur automatically? thank you in advance if anybody can help in any way, -A -- Igor Costa www.igorcosta.org http://www.igorcosta.org www.igorcosta.com http://www.igorcosta.com skype: igorpcosta
Re: [flexcoders] dataProvider question
It would be nice to see your part of you code to see what you are doing wrong. Regards. On 2/22/07, darvon4u [EMAIL PROTECTED] wrote: Here is an interesting one, not sure if i'm missing something or what. I have a list to show some data. I also have a component with an xmllist property which is marked as [Bindable] in actionscript, i instantiate that component and bind this data property to the list. When i receive data from webservice, i update the xmllist of the component. shouldn't the visual list update as well since it is bound to that component's property? also, i have tried this with an XMLListCollection as well and same result. only if i rebind the list to the component's property do i get the result. what i am doing wrong? is this by design? should there be something else wired or triggered for the updates to occur automatically? thank you in advance if anybody can help in any way, -A -- Igor Costa www.igorcosta.org www.igorcosta.com skype: igorpcosta
Re: [flexcoders] dataProvider question
Sure! my list is defined as follows: mx:List id=lstData width=100% height=100% labelField=@name /mx:List In my component (well, class) i have the following variable: [Bindable] public var MyDataList:XMLList = new XMLList(); then when the application loads and i get the instance of the component, i call the following: lstData.dataProvider = mycomponent.MyDataList; everything looks ok so far, right? then then when i receive a proper xml, i update it all inside the component: MyDataList = new XML(myxmlstring).children(); theoretically the lstData should somehow receive notification that the dataProvider has been updated and refresh itself, right? this doesn't seem to work. Since this doesn't seem to work we're reserved to throwing events from the component to the list and rebinding the list when that event is caught by the gui, but the whole thing is pretty cumbersome and i think this should work automatically what are we doing wrong? Thank you! On 2/22/07, Igor Costa [EMAIL PROTECTED] wrote: It would be nice to see your part of you code to see what you are doing wrong. Regards. On 2/22/07, darvon4u [EMAIL PROTECTED] wrote: Here is an interesting one, not sure if i'm missing something or what. I have a list to show some data. I also have a component with an xmllist property which is marked as [Bindable] in actionscript, i instantiate that component and bind this data property to the list. When i receive data from webservice, i update the xmllist of the component. shouldn't the visual list update as well since it is bound to that component's property? also, i have tried this with an XMLListCollection as well and same result. only if i rebind the list to the component's property do i get the result. what i am doing wrong? is this by design? should there be something else wired or triggered for the updates to occur automatically? thank you in advance if anybody can help in any way, -A -- Igor Costa www.igorcosta.org www.igorcosta.com skype: igorpcosta
Re: [flexcoders] dataProvider question
Hi, Andrey wrote: Sure! my list is defined as follows: mx:List id=lstData width=100% height=100% labelField=@name /mx:List In my component (well, class) i have the following variable: [Bindable] public var MyDataList:XMLList = new XMLList(); then when the application loads and i get the instance of the component, i call the following: lstData.dataProvider = mycomponent.MyDataList; everything looks ok so far, right? then then when i receive a proper xml, i update it all inside the component: MyDataList = new XML(myxmlstring).children(); theoretically the lstData should somehow receive notification that the dataProvider has been updated and refresh itself, right? this doesn't seem to work. Since this doesn't seem to work we're reserved to throwing events from the component to the list and rebinding the list when that event is caught by the gui, but the whole thing is pretty cumbersome and i think this should work automatically what are we doing wrong? I'm pretty green with this stuff so I might be wrong here... It looks like you are really changing the dataProvider - not the actual data. Perhaps if you try calling, lstData.dataProvider.refresh(); when you update the list it might refresh the view. I dont know, this is just a guess. As an aside, you might want to consider changing the name of your MyDataList variable to myDataList and lstData(which looks like it starts with a one rather than a lowercase L) to listData, which you can read easily. I dont think that one character is going to slow you down much in typing speed but makes the code much more readable. HTH. cheerio, - shaun
RE: [flexcoders] dataProvider question
Unless you have something that is preventing you from actually binding in mxml, you should just add dataProvider={mycomponent.MyDataList} as a property in the mx:List component. If you want to setup the bind in actionscript, you can use BindingUtils.bindProperty. http://livedocs.adobe.com/flex/2/docs/wwhelp/wwhimpl/common/html/wwhelp. htm?context=LiveDocs_Partsfile=1043.html Karl Cynergy From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Andrey Sent: Thursday, February 22, 2007 8:55 PM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] dataProvider question Sure! my list is defined as follows: mx:List id=lstData width=100% height=100% labelField=@name /mx:List In my component (well, class) i have the following variable: [Bindable] public var MyDataList:XMLList = new XMLList(); then when the application loads and i get the instance of the component, i call the following: lstData.dataProvider = mycomponent.MyDataList; everything looks ok so far, right? then then when i receive a proper xml, i update it all inside the component: MyDataList = new XML(myxmlstring).children(); theoretically the lstData should somehow receive notification that the dataProvider has been updated and refresh itself, right? this doesn't seem to work. Since this doesn't seem to work we're reserved to throwing events from the component to the list and rebinding the list when that event is caught by the gui, but the whole thing is pretty cumbersome and i think this should work automatically what are we doing wrong? Thank you! On 2/22/07, Igor Costa [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: It would be nice to see your part of you code to see what you are doing wrong. Regards. On 2/22/07, darvon4u [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Here is an interesting one, not sure if i'm missing something or what. I have a list to show some data. I also have a component with an xmllist property which is marked as [Bindable] in actionscript, i instantiate that component and bind this data property to the list. When i receive data from webservice, i update the xmllist of the component. shouldn't the visual list update as well since it is bound to that component's property? also, i have tried this with an XMLListCollection as well and same result. only if i rebind the list to the component's property do i get the result. what i am doing wrong? is this by design? should there be something else wired or triggered for the updates to occur automatically? thank you in advance if anybody can help in any way, -A -- Igor Costa www.igorcosta.org http://www.igorcosta.org www.igorcosta.com http://www.igorcosta.com skype: igorpcosta