jQWidgets Forums

jQuery UI Widgets Forums Plugins Data Adapter Data handling between source and adapter

This topic contains 1 reply, has 2 voices, and was last updated by  admin 5 years ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author

  • Klaus H
    Participant

    Hi,

    I need some help to handle data correctly. I have a page to manage some data. There is main data for which I have a source, put it into a dataAdapter und display it in a grid. Then I have associcated data, which I now load on demand from my database live to display and do data operations on (add, delete and update). I do these operations directly to the database and update the grids accordingly. Works very well, I would describe it like the master detail example from the grids, with the difference I have 3 detail grids and not one, but I will explain my question with just one to keep it simple.

    Now I have to change the behaviour, I have to load the master and detail data on the start in two arrays, which is no problem. I have to keep all the data on the website, manipulate it accordingly and have a final save button to compare the data in the database and the data I have manipulated.

    So I create the two source objects and two according dataadapters. When I select an entry in the main grid, I create a new dataadapter with the subselection of the corresponding data. The user can manipulate the main data and the detail data in the subselection.

    The question for me now is what is the best way to handle the data. As far as I have tracked it, when I delete an entry in the main grid via deleterow, the data is deleted from the dataadapter but not from the underlying source. Which in general is fine, I can take the records of the dataAdapter to compare to the data in the database. In the source of the main data, I have used the deleterow callback to delete the necessary data from the second dataAdapter. So as long as I do not call dataBind() on the adapter, that should be alright. Adding and updating data in the main grid should also be no problem because these operations are handled to the dataadapter.

    Now my problem is, how do I keep the second dataAdapter with the dependant data up to date, when I have to create a subselect of the dataAdapter into a new dataAdapter and add, delete or update data there. I could iterate through the records of the main adapter and delete or update accordingly, but what do I do if I add data? The records in the dataAdapter have 4 attributes that need to be set right (boundindex, uid, uniqueidand visibleindex), I don’t know if adding a record to the dataAdapter is the correct way to handle this.

    I hope you understand my problem and what I want to achieve. Is there a correct and smart way to do this? Am I missing something obvious?

    Thank you in advance!

    Best Regards
    Klaus H


    admin
    Keymaster

    My suggestion is only one adapter to handle your client-server connections and create new dataAdapters with the data loaded from the dataAdapter which communicates with your data server.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.