[CLOSED] Can't disable viewstate for the Store

  1. #1

    [CLOSED] Can't disable viewstate for the Store

    Has tried to make all:
    <ext:ResourceManager ID="ResourceManagerMain" runat="server" EnableViewState="false" RemoveViewState="true" />
    <ext:GridPanel ID="GridPanelMain" runat="server" EnableViewState="false">...
    <ext:Store ID="StoreMain" runat="server" EnableViewState="false">...
    But nothing. (( All data of store is in the viewstate

    I don't want to disable viewstate in a web.config file, because there are controls which demand viewstate.
    Last edited by Daniil; Jul 11, 2011 at 9:21 AM. Reason: [CLOSED]
  2. #2
    Hi,

    Store doesn't save a data into the viewstate (even if viewstate is activated)
    Why do you think that data is placed in viewstate?
  3. #3
    Also if you set RemoveViewState="true" for ResourceManager then viewstate will be exclude from the page at all (you will not see viewstate hidden field in the rendered page)
  4. #4
    Quote Originally Posted by Vladimir View Post
    Hi,

    Store doesn't save a data into the viewstate (even if viewstate is activated)
    Why do you think that data is placed in viewstate?
    Because I don't see the data in html source
  5. #5
    Please provide test sample
  6. #6
    <ext:ResourceManager ID="ResourceManagerMain" runat="server" Locale="pl" EnableViewState="false" EnableTheming="false" RethrowAjaxExceptions="true" RemoveViewState="true" />
        <ext:Viewport ID="ViewportMainExt" runat="server" Layout="border" >
            <Items>
    <ext:Panel ID="PanelMain"
                    runat="server" 
                    Title="Title"
                    Region="Center"
                    Split="false"
                    Header="true"
                    AutoScroll="true"
                    Collapsible="false">
                    <Content>
    
    <ext:BorderLayout>
    <Center>
            <ext:Panel ID="PanelDicListGrid" runat="server" Title="Lista urządzeń" Collapsible="false" Header="false" Split="true">
                <Items>
                    <ext:FitLayout ID="fl1" runat="server">
                        <Items>
                            <ext:GridPanel ID="GridPanelMain" runat="server" SelectionMemory="Enabled" TrackMouseOver="true" EnableViewState="false">
                                <Store>
                                    <ext:Store ID="StoreMain" runat="server" RemoteSort="true" OnRefreshData="Store1_RefreshData" EnableViewState="false">
                                        <Proxy>
                                            <ext:PageProxy />
                                        </Proxy>
                                        <Reader>
                                            <ext:JsonReader IDProperty="Id">
                                                <Fields>
                                                    <ext:RecordField Name="Id" Type="Int" />
                                                    <ext:RecordField Name="Nazwa" Type="String" />
                                                    <ext:RecordField Name="Model" Type="String" />
                                                    <ext:RecordField Name="KodKreskowy" Type="String" />
                                                    <ext:RecordField Name="NrSeryjny" Type="String" />
                                                    <ext:RecordField Name="NrInwentarzowy" Type="String" />
                                                    <ext:RecordField Name="NrPaszportu" Type="String" />
                                                    <ext:RecordField Name="Kategoria" Type="String" />
                                                    <ext:RecordField Name="Zestaw" Type="Boolean" />
                                                    <ext:RecordField Name="ZestawNazwa" Type="String" />
                                                    <ext:RecordField Name="Cena" Type="Float" />
                                                    <ext:RecordField Name="ServiceDate" Type="Date" />
                                                    <ext:RecordField Name="RokProdukcji" Type="Int" />
                                                    <ext:RecordField Name="Wycofano" Type="Boolean" />
                                                </Fields>
                                            </ext:JsonReader>
                                        </Reader>
                                        <BaseParams>
                                            <ext:Parameter Name="start" Value="0" Mode="Raw" />
                                            <ext:Parameter Name="limit" Value="100" Mode="Raw" />
                                            <ext:Parameter Name="sort" Value="" />
                                            <ext:Parameter Name="dir" Value="" />
                                        </BaseParams>
                                        <SortInfo Field="Nazwa" Direction="ASC" />
                                    </ext:Store>
                                </Store>
                                <ColumnModel ID="ColumnModel1" runat="server" EnableViewState="false">
    			                    <Columns>
                                        <ext:NumberColumn Header="Id" DataIndex="Id" Format="0" MenuDisabled="true" />
                                        <ext:Column Header="Nazwa" DataIndex="Nazwa" MenuDisabled="true" />
                                        <ext:Column Header="Typ" DataIndex="Model" MenuDisabled="true" />
                                        <ext:Column Header="Kod Kreskowy" DataIndex="KodKreskowy" MenuDisabled="true" />
                                        <ext:Column Header="Nr. Seryjny" DataIndex="NrSeryjny" MenuDisabled="true" />
                                        <ext:Column Header="Nr. Inwentarzowy" DataIndex="NrInwentarzowy" MenuDisabled="true" />
                                        <ext:Column Header="Nr. Paszportu" DataIndex="NrPaszportu" MenuDisabled="true" />
                                        <ext:Column Header="Kategoria" DataIndex="Kategoria" MenuDisabled="true" />
                                        <ext:BooleanColumn Header="Zestaw" DataIndex="Zestaw" FalseText="" TrueText="Tak" MenuDisabled="true" />
                                        <ext:Column Header="Nazwa zestawu" DataIndex="ZestawNazwa" MenuDisabled="true" />
                                        <ext:NumberColumn Header="Cena" DataIndex="Cena" Format="0.000,00 zł/i" MenuDisabled="true" />
                                        <ext:DateColumn Header="Data serwisu" DataIndex="ServiceDate" Format="dd-MM-yyyy" MenuDisabled="true" />
                                        <ext:NumberColumn Header="Rok Produkcji" DataIndex="RokProdukcji" Format="0" MenuDisabled="true" />
                                        <ext:CheckColumn Header="Wycofano" DataIndex="Wycofano" MenuDisabled="true" />
    			                    </Columns>
                                </ColumnModel>
                                <SelectionModel>
                                    <ext:CheckboxSelectionModel CheckOnly="false" KeepSelectionOnClick="WithCtrlKey" SingleSelect="false" />
                                </SelectionModel>
                                <BottomBar>
                                    <ext:PagingToolbar ID="PagingToolbar1" runat="server" PageSize="100" DisplayInfo="true" DisplayMsg="Wiersze {0} - {1} z {2}" EmptyMsg="Brak wierszy">
                                        <Plugins>
                                            <ext:SlidingPager />
                                        </Plugins>
                                    </ext:PagingToolbar>
                                </BottomBar>
                                <DirectEvents>
                                    <RowDblClick OnEvent="OnRowDblClick_GridPanelMain">
                                        <ExtraParams>
                                            <ext:Parameter Name="grow" Value="this.store.getAt(rowIndex).data['Id']" Mode="Raw" />
                                        </ExtraParams>
                                        <EventMask ShowMask="true" Msg="Proszę poczekać ..." />
                                    </RowDblClick>
                                </DirectEvents>
                                <LoadMask ShowMask="true" Msg="Proszę poczekać ..." />
                           </ext:GridPanel>
                        </Items>
                    </ext:FitLayout>
                </Items>
            </ext:Panel>
        </Center>
    </ext:BorderLayout>
    
                    </Content>
            </ext:Panel>
            </Items>
        </ext:Viewport>
            protected void Store1_RefreshData(object sender, StoreRefreshDataEventArgs e)
            {
                List<object> data = MMEwidencja.BLL.DeviceInfo.GetFullList().Cast<object>().ToList<object>();
    
                //-- start sorting ------------------------------------------------------------
                if (!string.IsNullOrEmpty(e.Sort))
                {
                    data.Sort(delegate(object x, object y)
                    {
                        object a;
                        object b;
    
                        int direction = e.Dir == Ext.Net.SortDirection.DESC ? -1 : 1;
    
                        a = x.GetType().GetProperty(e.Sort).GetValue(x, null);
                        b = y.GetType().GetProperty(e.Sort).GetValue(y, null);
                        return CaseInsensitiveComparer.Default.Compare(a, b) * direction;
                    });
                }
                //-- end sorting ------------------------------------------------------------
    
    
                //-- start paging ------------------------------------------------------------
                var limit = e.Limit;
    
                if ((e.Start + e.Limit) > data.Count)
                {
                    limit = data.Count - e.Start;
                }
    
                List<object> rangeData = (e.Start < 0 || limit < 0) ? data : data.GetRange(e.Start, limit);
                //-- end paging ------------------------------------------------------------
    
                //The Total can be set in RefreshData event as below
                //or (Store1.Proxy.Proxy as PageProxy).Total in anywhere
                //Please pay attention that the Total make a sence only during DirectEvent because
                //the Store with PageProxy get/refresh data using ajax request
    
                e.Total = data.Count;
    
                this.GridPanelMain.GetStore().DataSource = rangeData;
            }
  7. #7
    Hi,

    I don't see DataBind calling for the store after you set DataSource
  8. #8
    Quote Originally Posted by Vladimir View Post
    Hi,

    I don't see DataBind calling for the store after you set DataSource
    Most likely it is binded automatically after set DataSource. I more have found nothing. The project big. I cut these parts with MasterPage, Page and UserControl.

    But I don't see DataBind also here https://examples1.ext.net/#/GridPane...ilters_Remote/
  9. #9
    Wait, you don't see data in the grid? Or just don't see in the rendered html?
    Data will be absent in the html because it is retrieved by separate ajax request (because PageProxy is used)

Similar Threads

  1. [CLOSED] Viewstate too too too heavy
    By speedstepmem3 in forum 1.x Legacy Premium Help
    Replies: 8
    Last Post: Jun 19, 2013, 6:40 AM
  2. [CLOSED] ViewState Problem
    By thchuong in forum 1.x Legacy Premium Help
    Replies: 22
    Last Post: Sep 28, 2011, 3:35 PM
  3. [CLOSED] ViewState
    By Pablo_Azevedo in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Mar 22, 2011, 8:03 PM
  4. [CLOSED] ViewState value
    By asztern in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Nov 01, 2010, 11:14 AM
  5. Store with viewstate problem
    By songjuju in forum Bugs
    Replies: 0
    Last Post: Nov 07, 2008, 9:14 PM

Tags for this Thread

Posting Permissions