Question

I am working with Ext.Net 1.5

I want to validate ext:SpinnerField at Edit time..I want to set ext:SpinnerField maxValue at runtime.

    <ext:GroupingSummaryColumn Width="100" ColumnID="Qty" Header="Qty"
        Sortable="true" DataIndex="qty" Align="Right">
     <Editor>
        <ext:SpinnerField ID="txtQty" runat="server" AllowBlank="false" MinValue="1">
 <Listeners><BeforeShow Handler="txtQty.setMaxValue(record.data.qtydata);" /> </Listeners>
 </ext:SpinnerField>
    </Editor>
     </ext:GroupingSummaryColumn>

<BeforeShow Handler="txtQty.setMaxValue(record.data.qtydata);"> will set the maxvalue of mine spinnerField which i have to set.

Example: In following image their is 1 qty column and 1 column(which is without header) is for settings maximum value of sppinner.

I am editing first row it will set maxvalue=1 then edit 2nd row it will set maxvalue=3

enter image description here

but when again i am editing 1st row it will maxvalue=3 but that is wrong 1st row's maxvalue should be 1. enter image description here

Was it helpful?

Solution

You have to add listener to GridPanel's BeforeEdit event. Try this:

<ext:GridPanel>
...
<Listeners>
            <BeforeEdit Handler="
                 if (e.field == 'qty') 
                    txtQty.setMaxValue(e.record.data.qtydata);"></BeforeEdit>
        </Listeners>
</ext:GridPanel>

Full example you can see here: http://pastebin.com/WAgDJjQd

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top