PDA

View Full Version : [CLOSED] Get gridpanel column value from Javscript



canusr1
Aug 14, 2013, 4:02 AM
Hello,

I would like to get the column value from grid panel in javascript.

But the record value is undefined. Please check the following code and error msg.

Thank you.



<script>
var checkEditableInvoiceID = function (value, metadata, record, rowIndex, colIndex, store) {
alert(record.data.RECORD_STATUS);
};

</script>


<Store>
<ext:Store ID="sTransaction" runat="server" OnSubmitData="SubmitData" PageSize="30" OnReadData="sTransaction_RefreshData" AutoLoad="false">
<Model>
<ext:Model ID="Model1" runat="server" Name="CategoryMaster">
<Fields>
<ext:ModelField Name="RECORD_STATUS" Type="String" />
<ext:ModelField Name="INVOICEID" Type="String" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<ColumnModel ID="ColumnModel1" runat="server">
<Columns>
<ext:Column ID="RECORD_STATUS" runat="server" Text="RECORD STATUS" DataIndex="RECORD_STATUS" Visible="false">
</ext:Column>
<ext:Column ID="INVOICEID" runat="server" Text="Invoice No." DataIndex="INVOICEID" Width="100">
<Editor>

<ext:ComboBox ID="ddlInvoiceList" runat="server" EmptyText="Invoice No." DisplayField="INVOICEID" ValueField="INVOICEID" TypeAhead="false" HideBaseTrigger="true" TriggerAction="Query" MinChars="0" LabelWidth="120" Width="290">
<ListConfig LoadingText="Searching...">
<ItemTpl ID="ItemTpl1" runat="server">
<Html>
<div class="search-item">
{INVOICEID}
</div>
</Html>
</ItemTpl>
</ListConfig>
<Store>
<ext:Store ID="sInvoiceList" runat="server" AutoLoad="false">
<Proxy>
<ext:AjaxProxy Url="../HttpHandler/GetInvoiceIDListFromTransaction.ashx">
<ActionMethods Read="POST" />
<Reader>
<ext:JsonReader Root="InoviceIDList" TotalProperty="total" />
</Reader>
</ext:AjaxProxy>
</Proxy>
<Model>
<ext:Model ID="Model3" runat="server" IDProperty="INVOICEID">
<Fields>
<ext:ModelField Name="INVOICEID" Type="String"></ext:ModelField>
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<SelectedItems>
<ext:ListItem Index="0"></ext:ListItem>
</SelectedItems>
<Triggers>
<ext:FieldTrigger Icon="Search" Qtip="Click here to search Invoice." />
</Triggers>
<DirectEvents>
<TriggerClick OnEvent="SearchTransactionDetails">

<ExtraParams>
<ext:Parameter Name="INVOICEID" Value="#{ddlInvoiceList}.getValue()" Encode="false" Mode="Raw"></ext:Parameter>
</ExtraParams>
</TriggerClick>
<SpecialKey Before="return e.getKey() == e.ENTER;" OnEvent="SearchTransactionDetails">
<EventMask ShowMask="true" MinDelay="500" Msg="LOADING DATA..." />
</SpecialKey>
</DirectEvents>
</ext:ComboBox>
</Editor>
</ext:Column>
</Columns>
</ColumnModel>
<Plugins>
<ext:CellEditing ID="RowEdit" runat="server" ClicksToEdit="1">
<Listeners>
<BeforeEdit Fn="checkEditableInvoiceID">
</BeforeEdit>
</Listeners>
</ext:CellEditing>
</Plugins>



Error: Unable to get value of the property 'RECORD_STATUS': object is null or undefined

canusr1
Aug 14, 2013, 5:46 AM
Solve it out already as follow:

<Listeners>

<BeforeEdit Handler="if (e.record.get('RECORD_STATUS') != 'INSERT') { if(e.column.id == 'INVOICEID') {return false;}};"/>
</Listeners>