[CLOSED] PropertyGrid and Store - does that work?

  1. #1

    [CLOSED] PropertyGrid and Store - does that work?

    Hey,
    my initial problem was that I was trying to stop a PropertyGrid from being sorted. Now, there are a few posts here on that issue, and I have myself commented on one solution:
    http://forums.ext.net/showthread.php...d-disable-sort

    In that thread I say that using
    <Render Handler="this.getStore().sortInfo = undefined;" />
    works like a charm, but now when I get back to it (1 year later) I see that it doesnt stop sorting at all.

    Since I am adding properties using the .SetSource(...)-method I thought that using the above Handler won't work since I am not actually using a Store. So I try to add a store and populate the Store, but I cannot get any properties shown when using the following code:

    <ext:PropertyGrid runat="server" ID="executionPropertyGrid1" AutoHeight="true">
        <Store>
            <ext:Store runat="server" ID="StoreExecutionProperty">
                <Reader>
                    <ext:JsonReader>
                        <Fields>
                            <ext:RecordField Name="Name" SortType="None"></ext:RecordField>
                            <ext:RecordField Name="Value" SortType="None"></ext:RecordField>
                        </Fields>
                    </ext:JsonReader>
                </Reader>
            </ext:Store>
        </Store>
        <View>
            <ext:GridView ID="GridView3" runat="server" ScrollOffset="0" ForceFit="true">
                    <GetRowClass Handler="return record.data.value == '   ' ? 'my-class' : '';" />
            </ext:GridView>
        </View>
        <Listeners>
            <Render Handler="this.getStore().sortInfo = undefined;" />
        </Listeners>
    </ext:PropertyGrid>
    I have also tried with ArrayReader instead o JsonReader.

    In code-behind I populate the store like this:

    PropertyGridParameterCollection executionList = new PropertyGridParameterCollection();
    executionList.Add(new PropertyGridParameter("SomeProperty1", "Somevalue1"));
    executionList.Add(new PropertyGridParameter("SomeProperty2", "Somevalue2"));
    StoreExecutionProperty.DataSource = executionList;
    StoreExecutionProperty.DataBind();
    Any help is appreciated =)
    Last edited by Daniil; Jun 07, 2012 at 10:13 AM. Reason: Please use [CODE] tags for all code, [CLOSED]
  2. #2
    Hi,

    PropertyGrid internally uses its own store. So, if you need a custom Store, you should use a common GridPanel.

    Regarding sorting. It appears to be switched off in the example below (the BeforeRender listener disables columns sorting).

    Example
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <!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 runat="server">
        <title>Ext.NET Example</title>
    </head>
    <body>
        <ext:ResourceManager runat="server" />
        <ext:PropertyGrid runat="server" Width="200" AutoHeight="true">
            <Source>
                <ext:PropertyGridParameter Name="Prop1" Value="1" />
                <ext:PropertyGridParameter Name="Prop2" Value="2" />
            </Source>
            <Listeners>
                <Render Handler="this.getStore().sortInfo = undefined;" />
                <BeforeRender Handler="var columns = this.getColumnModel().config;
                                       columns[0].sortable = false;
                                       columns[1].sortable = false;" />
            </Listeners>
        </ext:PropertyGrid>
    </body>
    </html>
  3. #3
    Thanks for that.

    I will test it at some later point, as I indeed switched to a GridPanel instead.

Similar Threads

  1. Replies: 2
    Last Post: Mar 15, 2012, 12:57 AM
  2. Replies: 1
    Last Post: Feb 17, 2012, 7:22 AM
  3. Replies: 2
    Last Post: Aug 24, 2010, 2:02 PM
  4. Filtering Can't work in store
    By syed2uk in forum 1.x Help
    Replies: 1
    Last Post: Jan 19, 2010, 5:02 AM
  5. Replies: 7
    Last Post: Apr 15, 2009, 11:44 AM

Tags for this Thread

Posting Permissions