Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 6 of 6 total
Thread Hacking the dataset
Fri, Dec 9 2016 8:11 AMPermanent Link

Matthew Jones

I have data that I want to show on a form as a grid. The TGrid is perfect for this. So I fill up a TDataSet, and it shows nicely in the grid. I click on the grid, get an event to say the row has changed, and show other fields in a panel below. All good.

So I then click a button to save the data to the dataset, and it does so. But I can find now way to find out what changed as an outsider looking at the dataset.

The AfterSave and BeforeSave tell me that the data is saved, but not what was saved - I cannot determine the current row to look at. And the "Modified" flag is cleared by Save, so I cannot loop around the dataset to work out which I should transfer to the server.

I had a look at the Transactions, but it isn't suitable for my server use.

I therefore think that I'm pushing the dataset/grid combination in the wrong direction. Or did I miss something? I figure I will go unbound on the grid instead, so get ready for questions about that instead. 8-)

--

Matthew Jones
Fri, Dec 9 2016 9:17 AMPermanent Link

Ronald

"Matthew Jones" wrote:

<The AfterSave and BeforeSave tell me that the data is saved, but not what was saved - I cannot determine the current row to look at. And the "Modified" flag is cleared by Save, so I cannot loop around the dataset to work out which I should transfer to the server. >

Why do you want to know which row was saved? Have you considered using TDataSet.Columns[].OldValue?
Fri, Dec 9 2016 9:28 AMPermanent Link

Matthew Jones

Ronald wrote:

> Why do you want to know which row was saved? Have you considered using TDataSet.Columns[].OldValue?

I was sort of hoping that I could use it without getting into the weeds too much. The main event that appears to be the one to get is the state change, and that is rather too immediate for what I want to do. The thinking was that I have to generate a call back to the server, and I have to update the display grid. Two actions to get right, and I want to repeat this a lot so any sort of repeatability would be good. Thus the idea was to put it in the dataset, and then run over that and send the changes. Doesn't seem to be sensible, so I am looking at the unbound grid at the moment.

Speaking of the unbound grid, is there any decent summary of how to use it? Best I found so far is http://www.elevatesoft.com/forums?action=view&category=ewb&id=ewb_general&page=1&msg=6326#6326 which is not too complete.
What I would like to know is how I can tell the "true" index of a row when selected. The header sort is brilliant, but does it change the row index of the items?
And what string value is used to display things like boolean checkboxes? I can investigate, but a complete document would be good.

--

Matthew Jones
Fri, Dec 9 2016 10:00 AMPermanent Link

Matthew Jones

Matthew Jones wrote:

> What I would like to know is how I can tell the "true" index of a row when selected. The header sort is brilliant, but does it change the row index of the items?

The answer is yes, it changes the index. The solution is to have another column that is not visible, into which you put your index. That then gets sorted too, so you can find where you are.

--

Matthew Jones
Fri, Dec 9 2016 11:30 AMPermanent Link

Matthew Jones

What I really like about WebBuilder is that you are not restricted in any significant way. So, the dataset and grid didn't work for me. So I have to do my own grid filling. So I have a whole load of similar items to be edited using a grid. So I can now very easily make a "generic" form with a grid that takes a class that is then used to auto-fill the grid columns and read the data from the properties without it having to be done for each item specifically. I just have an abstract class function that returns the list of fields to be displayed, and it sorts the rest out.

This is, as usual, really powerful stuff.

--

Matthew Jones
Fri, Dec 9 2016 1:34 PMPermanent Link

Raul

Team Elevate Team Elevate

<<
"Matthew Jones" wrote:

So I then click a button to save the data to the dataset, and it does so. But I can find now way to find out what changed as an outsider looking at the dataset.

I had a look at the Transactions, but it isn't suitable for my server use.
>>

Even if you're not using transactions it might be worthwhile to see if you can just use the framework to capture changes the same  way - looks like you should be abel to derive your own TDatabase descendant and override the AddOperation and the make it parent of your dataset and see what you get (if should have operation type and row before and after)

Raul
Image