Get GridPanel rows on the store events.

  1. #1

    Get GridPanel rows on the store events.

    Hi,
    How can i get the grid's data from the store events?
    I try the following, but it is not working!

    
    
    
    <ext:Store ID="StoreBlockingRuleDetails" AutoLoad="true" DataSourceID="BlockingRuledetailsDataSource" runat="server" 
    
    
    OnRefreshData="StoreBlockingRulesDetails_Refresh"
    
    
    OnBeforeRecordInserted="StoreBlockingRulesDetails_BeforeRecoedInserted"
    
    
    OnBeforeRecordUpdated="StoreBlockingRulesDetails_BeforeRecoedUpdated"
    
    
    OnAfterAjaxEvent="StoreBlockingRulesDetails_AfterAjaxEvent"
    
    
    OnBeforeRecordDeleted="StoreBlockingRulesDetails_BeforeRecordDeleted"
    
    
    OnBeforeStoreChanged="test1" 
    
    
    OnBeforeAjaxEvent="test2"
    
    
    OnSubmitData="test3"
    
    
    ShowWarningOnFailure="false" >
    
    
    <BaseParams>
    
    
    <ext:Parameter Name="DetailsGrid" Value="Ext.encode(#{BlockingRuleItemsGrid}.getRowsValues(false))" Mode="Raw" />
    
    
    </BaseParams>
    
    
    <Reader>
    
    
    <ext:JsonReader ReaderID="BLOCK_RULE_DETAIL_ID">
    
    
    <Fields>
    
    
    <ext:RecordField Name="BLOCK_RULE_DETAIL_ID" Type="Int">
    
    
    <Convert Handler="" Args="value,record" FormatHandler="False"></Convert>
    
    
    </ext:RecordField>
    
    
    <ext:RecordField Name="BLOCK_RULE_ID" Type="Int">
    
    
    <Convert Handler="" Args="value,record" FormatHandler="False"></Convert>
    
    
    </ext:RecordField>
    
    
    <ext:RecordField Name="BLOCK_TYPE_ID" Type="Int">
    
    
    <Convert Handler="" Args="value,record" FormatHandler="False"></Convert>
    
    
    </ext:RecordField>
    
    
    <ext:RecordField Name="BLOCK_VALUE" Type="String">
    
    
    <Convert Handler="" Args="value,record" FormatHandler="False"></Convert>
    
    
    </ext:RecordField>
    
    
    </Fields>
    
    
    </ext:JsonReader>
    
    
    </Reader>
    
    
    <SortInfo Field="BLOCK_TYPE_ID" Direction="ASC" />
    
    
    <Listeners>
    
    
    <LoadException Handler="Ext.Msg.alert('Blocking Rules - Load failed', e.message || e )" />
    
    
    <CommitFailed Handler="Ext.Msg.alert('Blocking Rules - Commit failed', 'Reason: ' + msg)" />
    
    
    <SaveException Handler="Ext.Msg.alert('Blocking Rules - Save failed', e.message || e)" />
    
    
    <CommitDone Handler="Ext.Msg.alert('Blocking Rules - Commit', 'The data was successfully saved');" />
    
    
    </Listeners>
    
    
    
    
    
    </ext:Store>
    
    
    
    
    
    <ext:Store ID="StoreCboxBlockRuleType" runat="server">
    
    
    <Reader>
    
    
    <ext:JsonReader ReaderID="BLOCK_TYPE_ID">
    
    
    <Fields>
    
    
    <ext:RecordField Name="BLOCK_TYPE_ID" />
    
    
    <ext:RecordField Name="BLOCK_TYPE_NAME" />
    
    
    </Fields>
    
    
    </ext:JsonReader>
    
    
    </Reader>
    
    
    </ext:Store>
    While BlockingRuleItemsGrid is a gridpanel.

    when i try to get to the grid on one of the store event, Exception is thrown, for example:
    
    
    
    protected void test1(object sender, BeforeStoreChangedEventArgs e)
    
    
    {
    
    
    Store store = (Store)sender;
    
    
    string detailsGrid = store.BaseParams["DetailsGrid"];
    
    
    Dictionary<string, string>[] gridData = JSON.Deserialize<Dictionary<string, string>[]>(detailsGrid);
    }//Here I get Exception
    Can you help me with this??

    Thanks in advance!!!
    Yossi.
  2. #2

    RE: Get GridPanel rows on the store events.

    Hi,
    I just want to say that the purpose of this is to check on the before store changedevent if the grid is not empty if there is another way, it is also OK.
    Thanks!
    Yossi.

Similar Threads

  1. Replies: 1
    Last Post: Mar 29, 2012, 10:42 PM
  2. [CLOSED] GridPanel.Rows.Changing Background Color of Rows
    By supera in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Mar 01, 2012, 5:18 PM
  3. How to save new rows added to a GridPanel store
    By mattwoberts in forum 1.x Help
    Replies: 2
    Last Post: Jan 05, 2011, 8:54 AM
  4. Replies: 2
    Last Post: Dec 02, 2009, 12:08 PM
  5. Store/GridPanel with 17k+ rows - slow - help!
    By Tbaseflug in forum 1.x Help
    Replies: 1
    Last Post: Jun 03, 2009, 3:22 AM

Posting Permissions