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

Updating the cell from External Source

Hi,

I have attached each cell custom properties with my own model as we are using a MVC architecture in our application. I am able to access my model from the custom cell renderer and update it when ever the cell value changes. But I also want the cell to be updated whenever my model is changed from some external source. My model will raise events whenever something has changed and the view has to be refreshed.

I want to know
1. Whether I should be able to subscribe the the event from the model from within the custom cell renderer, because now I am creating the customproperties in the form and attaching it to the cell.
2.which will be the appropriate method to call to refresh the cell, once I subscribe to the events fired by the

thanks
thanvir

3 Replies

HA haneefm Syncfusion Team July 17, 2007 09:11 PM UTC

Hi Thanvir,

1. Whether I should be able to subscribe the the event from the model from within the custom cell renderer, because now I am creating the customproperties in the form and attaching it to the cell.
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
You can subscribe the any of the events from the GridModel within custom cell renderer. See the below forum thread for more details.

http://www.syncfusion.com/support/Forums/message.aspx?&MessageID=64184

2.which will be the appropriate method to call to refresh the cell, once I subscribe to the events fired by the
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
You can try calling the Refresh method after handling the event in custom cell renderer of the grid and let me know if this helps.

grid.Refresh() //For refreshing the whole table.
grid.RefreshRange(GridRangeInfo.Cell(2,2)) //For refreshing the range of cells in a grid.

Best regards,
Haneef


TH Thanvir Hussain July 18, 2007 09:20 AM UTC

Hi,
Sorry, I think you have got me wrong.
Our application is designed on a MVC architecture. So for every cell we have our own model which maintains the state of the cell. Now if I need to push the data from my model into the cell or refresh the cell when the my model data changes, I need to subscribe to the event raised by my coustom model.
I do the following to set the model to each of the cell.
SyncStyleProperties sp;

sp = new SyncStyleProperties(gridControl1[1, 1]);
gridControl1[1, 1].CellType = "FoxDatePickerCellModel";
gridControl1[1, 1].CellValue = defaultVal ;

sp.Model = new DateOrTenorModel("Test1");
sp.Model.Value = defaultVal;
Now this DateOrTenorModel will raise a event called CurrencyPairChanged which my cell have to subscribe and refresh itself. Please let me know where the cell can subscribe to the event.

I have attached a sample project for your reference which uses a custom date cell model which changes to red when sat or sun are selected.

Regards
thanvir

>Hi Thanvir,

1. Whether I should be able to subscribe the the event from the model from within the custom cell renderer, because now I am creating the customproperties in the form and attaching it to the cell.
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
You can subscribe the any of the events from the GridModel within custom cell renderer. See the below forum thread for more details.

http://www.syncfusion.com/support/Forums/message.aspx?&MessageID=64184

2.which will be the appropriate method to call to refresh the cell, once I subscribe to the events fired by the
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
You can try calling the Refresh method after handling the event in custom cell renderer of the grid and let me know if this helps.

grid.Refresh() //For refreshing the whole table.
grid.RefreshRange(GridRangeInfo.Cell(2,2)) //For refreshing the range of cells in a grid.

Best regards,
Haneef

DatePickerDemo.zip


JS Jeba S Syncfusion Team July 19, 2007 07:23 AM UTC

Hi Thanvir,

Thank you for your sample.

After the cellmodel has been created, you can try code such as :

FoxDatePickerCellRenderer r = (FoxDatePickerCellRenderer)this.gridControl1.CellRenderers["FoxDatePickerCellModel"];

to get the renderer. Using this renderer you can use the required delegate event handler of the custom control.

Kindly let us know if this helps.

Best Regards,
Jeba.

Loader.
Live Chat Icon For mobile
Up arrow icon