Apr 13, 2013, 8:41 AM
How to get the ComponentColumn's value?
Hello,All,I have used a componentColumn,and in the componentColumn,I added a ComboBox in it,the code is as this:
<ext:ComponentColumn ID="colItemCode" runat="server" Editor="true" DataIndex="StockPrice"
Text="<font color=blue>Item</font>" Width="120px">
<Component>
<ext:ComboBox ID="cbItemCode" runat="server" EmptyText="Select a item" StoreID="Store2"
TypeAhead="true" ForceSelection="true" DisplayField="ITEM_CODE" ValueField="ITEM_CODE"
MinChars="1" MatchFieldWidth="false" PageSize="10" Editable="false">
<ListConfig Width="400" Height="300" ItemSelector=".x-boundlist-item">
<Tpl ID="Tpl1" runat="server">
<Html>
<tpl for=".">
<tpl if="[xindex] == 1">
<table class="cbItems-list">
<tr>
<th>Code</th>
<th>Name</th>
<th>Spec</th>
<th>Unit</th>
</tr>
</tpl>
<tr class="x-boundlist-item">
<td>{ITEM_CODE}</td>
<td>{ITEM_NAME}</td>
<td>{ITEM_SPEC}</td>
<td>{UNIT}</td>
</tr>
<tpl if="[xcount-xindex]==0">
</table>
</tpl>
</tpl>
</Html>
</Tpl>
</ListConfig>
<Triggers>
<ext:FieldTrigger Icon="Clear" HideTrigger="true" />
</Triggers>
<Listeners>
<BeforeQuery Handler="this.getTrigger(0)[this.getRawValue().toString().length == 0 ? 'hide' : 'show']();" />
<TriggerClick Handler="if (index == 0) {
this.focus().clearValue();
trigger.hide();
}" />
<Select Handler="selectHandler(#{cbItemCode},#{Store1});" />
</Listeners>
</ext:ComboBox>
</Component>
</ext:ComponentColumn>
Then I use a function to get the combbox's value,I use this code: var selectHandler = function(combox, store)
{
alert(combox);
var itemCode = combox.value;
App.GridPanel1.body.mask('Loading...');
InboundX.QueryStore(itemCode, {
success: function(rs)
{
store.getAt(0).set('ItemID', rs[0]);
//store.getAt(0).set('ItemCode', rs[1]);
store.getAt(0).set('ItemName', rs[2]);
store.getAt(0).set('ItemSpec', rs[3]);
store.getAt(0).set('ItemBarcode', rs[4]);
store.getAt(0).set('ItemUnit', rs[5]);
store.getAt(0).set('CurrentStock', rs[6]);
store.getAt(0).set('StockPrice', rs[7]);
store.getAt(0).set('SellingPrice', rs[8]);
store.getAt(0).set('InStockQty', rs[9]);
},
complete: function(rs)
{
App.GridPanel1.body.unmask();
},
error: function()
{
App.GridPanel1.body.unmask();
}
});
};
But the combbox will alert "undefined",how can I get the combbox's value?
Last edited by geoffrey.mcgill; Apr 13, 2013 at 4:14 PM.