[CLOSED] Request: Add DataView.Select(id as object)

  1. #1

    [CLOSED] Request: Add DataView.Select(id as object)

    It will be nice to do:

    dim targetID = ""
    myDataView.Select(targetID)
    vs

    dim targetID = ""
    myDataView.Select(new Ext.net.ModelProxy() { myDataView.GetStore().GetById(targetID) })
    seems like more often, we want to select by id vs by array of modelproxy, especially since during directmethod, we usually just the ID and not the model record.
    Last edited by Daniil; Mar 22, 2013 at 7:38 AM. Reason: [CLOSED]
  2. #2
    Hi @jchau,

    Thank you for the request. We will implement.

    Methods applying an IEnumerable of indexes and ids would be also helpful.
  3. #3
    The methods were added to the SVN trunk and will be included to the next release.

    Example
    <%@ Page Language="C#" %>
     
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
     
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!X.IsAjaxRequest)
            {
                Store store = this.DataView1.GetStore();
                store.DataSource = new object[]
                {
                    new object[] { "test1" },
                    new object[] { "test2" },
                    new object[] { "test3" },
                    new object[] { "test4" },
                    new object[] { "test5" }
                };
                store.DataBind();
            }
        }
     
        protected void Select1(object sender, DirectEventArgs e)
        {
            this.DataView1.Select(new int[] { 0, 2 });
        }
    
        protected void Select2(object sender, DirectEventArgs e)
        {
            this.DataView1.Select(new List<object>() { "test2", "test4" });
        }
    
        protected void Select3(object sender, DirectEventArgs e)
        {
            this.DataView1.Select("test5");
        }
    </script>
     
    <!DOCTYPE html>
    
    <html>
    <head runat="server">
        <title>Ext.NET Example</title>
     
        <style>
            .my-dataview .x-item-selected {
                background-color: gray;
            }
        </style>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
            <ext:DataView
                ID="DataView1"
                runat="server"
                Cls="my-dataview"
                MultiSelect="true"
                ItemSelector="div.my-item">
                <Store>
                    <ext:Store runat="server">
                        <Model>
                            <ext:Model runat="server" IDProperty="test">
                                <Fields>
                                    <ext:ModelField Name="test" />
                                </Fields>
                            </ext:Model>
                        </Model>
                    </ext:Store>
                </Store>
                <Tpl runat="server">
                    <Html>
                        <tpl for=".">
                            <div class="my-item">{test}</div>
                        </tpl>
                    </Html>
                </Tpl>
            </ext:DataView>
    
            <ext:Button runat="server" Text="Select by indexes" OnDirectClick="Select1" />
            
            <ext:Button runat="server" Text="Select by ids" OnDirectClick="Select2" />
    
            <ext:Button runat="server" Text="Select by id" OnDirectClick="Select3" />
        </form>
    </body>
    </html>
    Last edited by Daniil; Mar 22, 2013 at 7:38 AM.

Similar Threads

  1. [CLOSED] Select dataview row when page loads
    By jpadgett in forum 2.x Legacy Premium Help
    Replies: 3
    Last Post: Feb 28, 2013, 4:04 PM
  2. Replies: 4
    Last Post: Oct 27, 2012, 10:59 AM
  3. [CLOSED] DataView to DataView Drag and Drop
    By paulc in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: May 10, 2012, 8:19 PM
  4. List Collections Object with Dataview
    By CoolNoob in forum 1.x Help
    Replies: 4
    Last Post: Dec 18, 2009, 3:00 AM
  5. dataview single select
    By [WP]joju in forum 1.x Help
    Replies: 0
    Last Post: Mar 30, 2009, 9:39 AM

Posting Permissions