PDA

View Full Version : [CLOSED] Editable ComponentColumn in a Gridpanel setting MaxValue



Kev
Sep 19, 2012, 8:17 AM
Hi,
In version 1.x of EXT.NET, I could do the following with a numberfield as an editor within a gridpanel, and it would apply the maxvalue to the numberfield in the editable column for each row:


((NumberField)this.gridPanel1.ColumnModel.Columns[5].Editor[0]).MaxValue = Convert.ToDouble(balance.ToString("#0.00"));

I've now converted the code to 2.0, and use a ComponentField and NumberField for the editor. I can access the ComponentColumn/Numberfield in the in the codebehind and I can apply the maxvalue to the field, like this:


ComponentColumn cc = ((ComponentColumn)this.gridPanel1.ColumnModel.Colu mns[5];
Numberfield nf = ((NumberField)cc.Component[0]);
nf.MaxValue = 1000;

The code compiles fine, but I now get a javascript error telling me the control is undefined? This didn't happening in 1.x. I'm wondering what the solution is to do the same as I did in 1.x?

Many Thanks,
Kev

Daniil
Sep 19, 2012, 11:25 AM
Hi,

I can suggest the following solution for ComponentColumn.

this.GridPanel1.Set("columns[0].component.maxValue", 1000);
this.GridPanel1.GetView().Refresh();

If there is no View for GridPanel, please set up:

<View>
<ext:GridView ID="GridView1" runat="server" />
</View>

Daniil
Nov 23, 2012, 2:05 PM
Hi,

I can suggest the following solution for ComponentColumn.

this.GridPanel1.Set("columns[0].component.maxValue", 1000);
this.GridPanel1.GetView().Refresh();

If there is no View for GridPanel, please set up:

<View>
<ext:GridView ID="GridView1" runat="server" />
</View>

This doesn't work anymore.

Any changes of the Component should be done within a ComponentColumn's Bind listener.