PDA

View Full Version : [CLOSED] Grid cell refresh and change column background color



chinninani
Jul 29, 2013, 11:44 AM
Hi Team,

I am creating grid dynamically in server side.

I am facing 2 problems in this.

1) In grid, I have combo box column and one text field column.

Based on combo box column selection, beside text field column value should change dynamically.

When I select value from combo box, server side its updating properly, where as in screen its not updating.

If we refresh the page after selection, then its showing updated data.

2) How can I change the background color of text field column?

Please provide the solution.

Regards,
Chinni

Daniil
Jul 29, 2013, 12:52 PM
Hi @chinninani,

1. How do you update the value on server side?

2. Text field column? Are you using a ComponentColumn?

chinninani
Jul 29, 2013, 1:10 PM
Hi Daniil,

Thanks for quick response.

I am using only Column class not component column.

Here is my server side code:

X.GetCmp<Store>("storeId").GetById(id).Commit();

Regards,
Chinni

Daniil
Jul 29, 2013, 3:30 PM
I am using only Column class not component column.

Here is my server side code:

X.GetCmp<Store>("storeId").GetById(id).Commit();


The Commit method commits all changes made to the instance since either creation or the last commit operation.
http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.data.Model-method-commit

So, it doesn't change a record. Please clarify how do you change the value of the specified Column according to the selected item in the ComboBox?

You might need to use the Set method, but I am not sure it is the best in your scenario.

X.GetCmp<Store>("storeId").GetById(id).Set("dataIndex", "value");

If you provide us with a test case, I think it would clarify everything.

As for colorizing cells, please use a Column's Renderer.Do you need to apply some color initial and forever or it depends on some condition?

If the first, you can apply custom CSS on cells. Here is an example.
http://examples2.ext.net/#/GridPanel/Miscellaneous/Custom_UI/

If the second, using a Column's Renderer is better.
http://examples2.ext.net/#/GridPanel/ArrayGrid/Simple/
http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.grid.column.Column-cfg-renderer

P.S. In the future please keep one topic per one thread.