We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Can I do this with an expression ?

I will be changing the values in columns at random based on something changing, temperature, price, qty on hand etc... Can I create an expression that could evaluate the new value against the old value and change another column based on wether or not the column quantity has increased from the previous value or decreased from the previous value? If I cannot how would you suggest I proceed. Thanks

7 Replies

AD Administrator Syncfusion Team November 29, 2005 04:43 PM UTC

I do not think then is any way of using an ExpressionFieldDescriptor type column to get this behavior. The GridGroupingControl does not cache prior values for you. So, you will have to manage this in some manner outside the grid. Exactly how to you expect these values to change? Will your user chnage them exclusively through the grid? If so, then it would simplify things. If you expect the data to be changed outside the grid, exactly what is teh datasource. Is it an IBindingList? If so, the grid is only notified when IBindingList.ListChanged is raised. And this is normally only done as you end the edit on a ''record''. So, if 3 or 4 fields in the same record were modified outside the grid, the grid would not know about it until the ListChnaged is raised indicating the record has changed. So, depending upon your exact requirements, I think the implementation of this requirement may run from straight-forward to some significant work.


ST StephenH December 1, 2005 05:53 PM UTC

OK, I found some samples in the forums but still am a little confused. I need to get the old value and compare it with the new value and change the background based on the comparison. we have a lot of changes coming into the grid, how can I accomplish this as fast as possible? Thanks >I do not think then is any way of using an ExpressionFieldDescriptor type column to get this behavior. The GridGroupingControl does not cache prior values for you. > >So, you will have to manage this in some manner outside the grid. Exactly how to you expect these values to change? Will your user chnage them exclusively through the grid? If so, then it would simplify things. If you expect the data to be changed outside the grid, exactly what is teh datasource. Is it an IBindingList? If so, the grid is only notified when IBindingList.ListChanged is raised. And this is normally only done as you end the edit on a ''record''. So, if 3 or 4 fields in the same record were modified outside the grid, the grid would not know about it until the ListChnaged is raised indicating the record has changed. > >So, depending upon your exact requirements, I think the implementation of this requirement may run from straight-forward to some significant work.


AD Administrator Syncfusion Team December 1, 2005 06:08 PM UTC

What is your data source? You will have to work directly with the data source if you want the changes to happen cell by cell. If you are willing to work row by row, and your datasource is an IBindingList, then you can handle it in the grid. If you will explain what your datasource is, then I may be able to offer some suggestions on how to go about doing what you want to do.


ST StephenH December 1, 2005 06:14 PM UTC

We are using a dataset >What is your data source? > >You will have to work directly with the data source if you want the changes to happen cell by cell. > >If you are willing to work row by row, and your datasource is an IBindingList, then you can handle it in the grid. > >If you will explain what your datasource is, then I may be able to offer some suggestions on how to go about doing what you want to do. >


AD Administrator Syncfusion Team December 1, 2005 06:56 PM UTC

Here is one way you can do this. It caches the original values in another datatable. http://www.syncfusion.com/Support/user/uploads/GGC_UpdateOutSideCellByCell_5f4a24c0.zip


ST StephenH December 1, 2005 07:30 PM UTC

I''m sorry but that does not even sound like a valid solution. If I can get the previous value and the new value in a different event then I feel like we should be able to do the same here. Thanks for trying but that just won''t do, we would rather do without. >Here is one way you can do this. It caches the original values in another datatable. >http://www.syncfusion.com/Support/user/uploads/GGC_UpdateOutSideCellByCell_5f4a24c0.zip > >


AD Administrator Syncfusion Team December 1, 2005 08:28 PM UTC

One point you must understand about the GridGroupingControl. Everytime it goes to draw a cell, if asks (through QueryCellStyleInfo) what color should this cell be (for example). At that point, if you are relying on the standard appearance architecture, it will get a color from somewhere for you (it might come from the Column.Appearance.AnyyCell.backColor property you have set, for example). But if you want to have a special color for a particular cell (based on whatever criteria you decide), then you have to be prepared somehow to provide that color in QueryCellStyleInfo every time the cell needs to be drawn. The point is, you will need this color time and time again. In your case, this means that you have to cache something for everycell that changes, and be able to retrieve it in QueryCellStyleInfo so you can provide the color that you want to see. So, in the little sample I did, just cached the whole table to make things simple to understand what was required. In your case, you would probably (maybe not) only want to cache the values as they changed. But if you expect all the values to change, then you gain nothing and add complexity by just caching a few values.

Loader.
Live Chat Icon For mobile
Up arrow icon