StrataFrame Forum

BO data reordering

http://forum.strataframe.net/Topic27651.aspx

By Ian Hammond - 7/12/2010

My application has a table of items and anther table comprising a list of pictures for the item. When I show the data for an

item, I also display a column of thumbnails. The pictures are stored by filename, item_id, order of preference, pk. When the app

starts, it fills the picture BO with all the data, to display the thumbnails of an item I filter the BO and pass a file list to

the thumbnail class. The user can exchange the position of the thumbnails and this generates an event which edits the filtered BO

by exchanging the order of preference values. I then Save the BO. If I move to the next item and then back to the edited one,

the thumbnails are displayed in there original order. The data is saved correctly in the database and I can overcome this by

performing anther fill, but I don't want to do this every time I save the data.

Is there an easier way of reordering the data in the BO?

Many thanks in advance.

By Edhy Rijo - 7/13/2010

Hi Ian,



You have to play with the BO.Sort(), but be very careful with Sort and Filter since your code needs to be aware of these conditions, specially the BO.Filter.



I believe that if you apply a BO.Sort condition will take care of your situation, if this is not the case, then try posting some of the code you are using.
By Greg McGuffey - 7/13/2010

I think you might want to take a step back and think about what data is being shown vs. saved. It seems to me that you have a BO that is filled when you load, then you change the preference order some other way. I.e. you don't update the filled BO directly. Are you calling a sproc or running an update via the BO, rather than actually changing the order via the strongly typed properties? I would think that if you are actually changing the properties within the BO used to control the display, then all would work fine. Essentially, you have to some how refresh the BO controlling the display with the new data. Likely this would be easiest if you just made the change directly in this BO.
By Ian Hammond - 7/13/2010

That sorted it, many thanks.
By Greg McGuffey - 7/14/2010

Glad you got it working Ian. Did you use Edhy's sorting suggestion or did something else work?