[CLOSED] SortInfo tag in Store

  1. #1

    [CLOSED] SortInfo tag in Store



    Hi Im using a <ext:Store that shows data from an array. this store has the GroupField property set. This generates an error if the SortInfo tag is not used. I noticed that the SortInfo only is able to sort one column, I need to sort several columns.
    The error does not apper if I leave the Field="" blank
    
    
    <ext:Store ID="Store1" runat="server" GroupField="Id" >
    <Reader>
    <ext:ArrayReader>
    <Fields>
        <ext:RecordField Name="Id" />
        <ext:RecordField Name="Name1" />
        <ext:RecordField Name="Name2" />
    <Fields>
    </ext:ArrayReader>
    </Reader>
    <SortInfo Field="" Direction="ASC" />
    </ext:Store>
    How do I solve this?

    Best regards
    Mikael Jürke

    Best regards
    Mikael Jürke
  2. #2

    RE: [CLOSED] SortInfo tag in Store

    Can you post full code of example?
    Do you have column in GridPanel which reference to Id field? You can add this column and make it Hidden
  3. #3

    RE: [CLOSED] SortInfo tag in Store

    I can make a full example if needed later on. But my question is simple.
    1. Is it possible to sort on more than one column?
    <SortInfo Field="Id, Name1, Name2" Direction="ASC" />
    2. Why is the SortInfo tag required when using GroupField="Id" in <ext:Store.

    And to awnser you question, No the "Id" is not a column in the grid. the "Id" is the grouping field.

    Best regards
    Mikael Jürke
  4. #4

    RE: [CLOSED] SortInfo tag in Store

    I asked about your example because it is strange that with blank sort info you have no js error

    1. Local grouping will only work with local sorting as the 2 are intertwined.
    2. Multiple-column sorting doesn't support.
  5. #5

    RE: [CLOSED] SortInfo tag in Store

    Hi
    Here comes an example

    
    
    
    public partial class Test_Default : System.Web.UI.Page
    {
        object[] objArray = new object[] { };
    
    
        protected override void OnInit(EventArgs e)
    
    
        {
    
    
            LoadData();
    
    
        }
    
    
    Protected void LoadData()
    {
        ArrayList listData = new ArrayList(objArray);
        listData.Add(new object[] { "Group 1", "A", "B" });
        listData.Add(new object[] { "Group 1", "A", "A" });
        listData.Add(new object[] { "Group 1", "C", "B" });
        listData.Add(new object[] { "Group 1", "C", "A" });
        listData.Add(new object[] { "Group 1", "B", "B" });
        listData.Add(new object[] { "Group 1", "B", "A" });
        listData.Add(new object[] { "Group 2", "A", "A" });
    
    
        this.Store1.DataSource = listData;
    
    
        this.Store1.DataBind();
    
    
    }
    
    
    protected void Store1_RefershData(object sender, StoreRefreshDataEventArgs e)
    {
        LoadData();
    }
    
    
    }
    
    
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    
    
    <head id="Head1" runat="server">
    
    
    <title></title>
    
    
    <link href="TravelPerfectSalesPort.css" rel="stylesheet" type="text/css" />
    
    
    
    
    
    </head>
    
    
    <body>
    
    
    <form id="form1" runat="server">
    
    
    <ext:ScriptManager ID="ScriptManager1" runat="server">
    
    
    </ext:ScriptManager>
    
    
    
    
    
    <ext:Store ID="Store1" runat="server" GroupField="GroupID" OnRefreshData="Store1_RefershData" >
    
    
    <Reader>
    
    
    <ext:ArrayReader>
    
    
    <Fields>
    
    
    <ext:RecordField Name="GroupID" />
    
    
    <ext:RecordField Name="Col1" />
    
    
    <ext:RecordField Name="Col2" />
    
    
    </Fields>
    
    
    </ext:ArrayReader>
    
    
    </Reader>
    
    
    <SortInfo Field="" Direction="ASC" />
    
    
    </ext:Store>
    
    
    
    
    
    <ext:GridPanel 
    
    
    ID="GridPanel" 
    
    
    runat="server" 
    
    
    StoreID="Store1" 
    
    
    StripeRows="true"
    
    
    AutoHeight="true"
    
    
    > 
    
    
    <ColumnModel ID="ColumnModel1" runat="server">
    
    
    <Columns>
    
    
    <ext:Column ColumnID="GroupID" Header="Group ID" DataIndex="GroupID" />
    
    
    <ext:Column ColumnID="Col1" Header="Col 1" DataIndex="Col1" />
    
    
    <ext:Column ColumnID="Col2" Header="Col 2" DataIndex="Col2" />
    
    
    </Columns>
    
    
    </ColumnModel> 
    
    
    <View>
    
    
    <ext:GroupingView ID="GroupingView1" 
    
    
    HideGroupedColumn="true"
    
    
    runat="server" 
    
    
    ForceFit="true"
    
    
    StartCollapsed="true"
    
    
    GroupTextTpl='{text} ({[values.rs.length]} {[values.rs.length > 1 ? "Groups" : "Group"]})'
    
    
    EnableRowBody="false">
    </ext:GroupingView>
    </View>
    </ext:GridPanel>
    </form>
    </body>
    </html>

    Best regards
    Mikael Jürke
  6. #6

    RE: [CLOSED] SortInfo tag in Store

    Hi Mikael,

    I investigated your example. Yes, in your example the blank Field in the SortInfo did a trick. But this work-around can't works in all cases (for example, if you add Proxy to the Store then you get js error related with empty Field in SortInfo). I made changes and now if sort info is absent then GroupField using in sorting logic.

    So you must remove SortInfo with empty Field. Now the Grouping can works without SortInfo

    The code in the SVN

Similar Threads

  1. [CLOSED] Change GridPanel SortInfo from code behind
    By jmcantrell in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: May 10, 2011, 6:33 AM
  2. Store.OnRefreshData and SortInfo
    By Awrong in forum 1.x Help
    Replies: 1
    Last Post: Dec 30, 2009, 6:04 AM
  3. Setting SortInfo dynamically
    By lionelhutz in forum 1.x Help
    Replies: 4
    Last Post: Oct 06, 2009, 10:35 AM
  4. PagingMemoryProxy doesn't obey SortInfo
    By shaun in forum 1.x Help
    Replies: 8
    Last Post: Jul 29, 2009, 2:48 PM
  5. Error when setting store.SortInfo in codebehind
    By plykkegaard in forum 1.x Help
    Replies: 0
    Last Post: May 19, 2009, 4:57 PM

Posting Permissions