8 Replies Latest reply on Jul 6, 2006 7:57 AM by samdl1

    XML refresh

    Tolk Level 1
      I'm loading data from an XML file into a xml connector --> into a dataset --> into a datagrid components. The datagrid is editable so the user can change values in it etc.
      I want the user to be able to re-set the datagrid to its original state at the click of a button. I was using XmlConn.trigger(); method to do this - this means re-loading all the xml data which can take a few seconds and is annoying if you want to do this multiple times.
      I'm not sure if this is correct but to my knoledge: When you make changes to the dataGrid it doesnt make the change to the loaded xml (i tested this by doing xmlcon.results after each change to the datargid).
      Is there a way of just refreshing the datagrid with the already loaded xml data rather than having to reload the data each time?
        • 1. XML refresh
          Tolk Level 1
          really need an awnser for this one please, is there a method or not one?
          • 2. Re: XML refresh
            kanukukreja Level 1
            use java sript function for dat
            • 3. XML refresh
              Tolk Level 1
              anything a bit less vague? i'm not experienced with JS so some code to point me in right direction would be helpful!

              I still don't understand why there isn't a refresh method or something. The original data is still there (like i said i tested for it with xmlconnector.results();) i just can't find a method to refresh the dataGrid with original data; without doing .trigger(); which reloads the data from the external file.

              • 4. Re: XML refresh
                blemmo Level 1
                I'm not familiar with datagrids, but have 2 thoughts:
                you said the data gets loaded into a dataset first and then into the datagrid. Now I don't know if the dataset also changes when the datagrid is edited, if not, you could probably just re-assign the dataset to the datagrid?
                Another way: if the xml data still exists, why not call the the onLoad event again for reloading? I mean, there should be some function that transfers the data into the grid when the xml was loaded. Just do this again for the reload.

                • 5. Re: XML refresh
                  Tolk Level 1
                  Those were my thoughts blemmo, but i can't find the method to reload thats the problem. The function that iv'e been using to load the data into the datagrid is the xmlconnection.trigger(); which also reloads the raw xml from the file. I havent tried re-assigning the dataset but i'm not sure about this as they are all connected using bindings - i havent seen any reference to these in AS help but i may just be missing it, i'll have another look.
                  • 6. Re: XML refresh
                    Perhaps the best thing would be to store a 'backup' of the data in an object or array and reset the datagrid from there using

                    my_dg.dataProvider = my_obj;
                    • 7. Re: XML refresh
                      Tolk Level 1
                      I tried doing this:

                      var test = items_ds.dataProvider;
                      items_ds.dataProvider = test;

                      And it seems to do something: it pauses a split second as if loading data, it resets the item in focus on the datagrid to the first item, but it doesnt seem to refresh the data back to the original values.
                      I tried using:


                      after, but it made no difference.
                      This is so annyoing, the data is there, i know this, i just cant get it to refresh in anyway and the documentation on this is so vague.
                      Anyone got more ideas?
                      • 8. Re: XML refresh
                        samdl1 Level 1
                        Hi Tolk,

                        I know its been a while but I just came accross a solution and immediatley thought of you...

                        The problem is with Flash, when a datagrid needs to be reloaded the dg is supposed to recieve a broadcast message called "updateAll". However, changing the dataprovider doesnt send out this message as it should, the datagrid doesnt know its supposed to change its info and nothing happens.

                        The solution is to use a dataset as an intermediary...the help files should get you started and I can help if you struggle (if its still an issue of course)