[CLOSED] "GetRowClass" Handler Returns "rowParams" null

  1. #1

    [CLOSED] "GetRowClass" Handler Returns "rowParams" null

    Hi guys,

    
    <%@ Page Language="C#" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <body id="theBody">
        <ext:ResourceManager ID="theManager" runat="server" 
            IDMode="Static"
            Theme="Default"
            ShowWarningOnAjaxFailure="false" 
            DirectMethodProxy="Ignore" 
            ScriptMode="Debug" />
        <ext:GridPanel runat="server">
            <Store>
                <ext:Store runat="server" ID="ds">
                    <Model>
                        <ext:Model runat="server">
                            <Fields>
                                <ext:ModelField Name="A" />
                            </Fields>
                        </ext:Model>
                    </Model>
                </ext:Store>
            </Store>
            <ColumnModel>
                <Columns>
                    <ext:Column runat="server" DataIndex="A" Text="A" />
                </Columns>
            </ColumnModel>
            <View>
                <ext:GridView runat="server">
                    <GetRowClass Handler="window.alert(rowParams);" />
                </ext:GridView>
            </View>
            <Features>
                <ext:RowBody runat="server" />
            </Features>
        </ext:GridPanel>
    </body>
    </html>
    <script runat="server">
    
    
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            ds.Data = new List<object> 
            { 
                new { A = "1" }, 
                new { A = "2" }, 
                new { A = "3" }
            };
            ds.DataBind();
        }
    
    
    </script>
    It gives "rowParams" null all the time. Anything missing?
    Last edited by Daniil; Sep 13, 2013 at 4:27 AM. Reason: [CLOSED]
  2. #2
    Hi @cleve,

    It is marked "deprecated" in ExtJS 4.1.3.
    http://docs.sencha.com/ext-js/4-1/#!...od-getRowClass

    So, I think it stops functioning in ExtJS 4.2. The SVN trunk currently uses ExtJS 4.2.0 beta 2.

    You should use a RowBody's GetAdditionalData handler.
  3. #3
    Quote Originally Posted by Daniil View Post
    Hi @cleve,

    It is marked "deprecated" in ExtJS 4.1.3.
    http://docs.sencha.com/ext-js/4-1/#!...od-getRowClass

    So, I think it stops functioning in ExtJS 4.2. The SVN trunk currently uses ExtJS 4.2.0 beta 2.

    You should use a RowBody's GetAdditionalData handler.
    I got how it works. But, as I've viewed example in ExtJS DOC

    
    viewConfig: {    getRowClass: function(record, rowIndex, rowParams, store){        return record.get("valid") ? "row-valid" : "row-error";    }}
    It presents a way to switch rowCls between "valid" and "invalid". But my code by using GetAdditionalData failed to set the same kind. Could you help me to pick up a little?

    
    <%@ Page Language="C#" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
        <head>
            <link href="/themes/shared.css" type="text/css" rel="stylesheet" />
            <style type="text/css">
                .testCls, .testCls *
                {
                    background-color:gray;
                    color:red;
                }
            </style>
        </head>
    <body id="theBody">
        <ext:ResourceManager ID="theManager" runat="server" 
            IDMode="Static"
            Theme="Default"
            ShowWarningOnAjaxFailure="false" 
            DirectMethodProxy="Ignore" 
            ScriptMode="Debug" />
        <div class="testCls">
            CLASS TEST
        </div>
        <ext:GridPanel runat="server">
            <Store>
                <ext:Store runat="server" ID="ds">
                    <Model>
                        <ext:Model runat="server">
                            <Fields>
                                <ext:ModelField Name="A" />
                            </Fields>
                        </ext:Model>
                    </Model>
                </ext:Store>
            </Store>
            <ColumnModel>
                <Columns>
                    <ext:Column runat="server" DataIndex="A" Text="A" />
                </Columns>
            </ColumnModel>
            <Features>
                <ext:RowBody runat="server">
                    <GetAdditionalData Handler="orig.rowCls='testCls';" />
                </ext:RowBody>
            </Features>
        </ext:GridPanel>
    </body>
    </html>
    <script runat="server">
    
    
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            ds.Data = new List<object> 
            { 
                new { A = "1" }, 
                new { A = "2" }, 
                new { A = "3" }
            };
            ds.DataBind();
        }
    
    
    </script>
    The "testCls" just can't be cast on row. Appreciate if Daniil can help me :)
  4. #4
    Well, for this task you should still use a GetRowClass. The "rowParams" should not be required to return a CSS class name from a GetRowClass handler.
  5. #5
    That's it. I am done on this issue. Thanks for the help. Please mark the thread "Closed".
  6. #6

    Same Issue

    I don't believe this issue was ever resolved. The root cause of this issue that I think cleve was trying to get to is that in the extjs source, when using 'GetRowClass' the following happens:

    //renderRow in Ext.view.Table
    cls = me.getRowClass(record, rowIdx, null, me.dataSource);
    
    //Ext.apply(Ext.grid.View.prototype...
    this.getRowClass = function(rec, rowIndex, rowParams, store){
                            var result = this.__getRowClass(rec, rowIndex, rowParams, store);
                            if (rowParams.body) { //<-- Always Fails

    All I'm trying to do on a standard grid is set a row's style to a modelField called cls that is passed from the server.

                    <ViewConfig TrackOver="false">
                        <GetRowClass Fn="function(record){return record.data.cls;}">
                        </GetRowClass>
                    </ViewConfig>
    As GetRowClass itself is not deprecated I believe this is a bug and should be opened.

    As a workaround I've overridden 'renderRow' and am passing an object to me.getRowClass like this:

     me.getRowClass(record, rowIdx, 0, me.dataSource);
    Although ugly, this way the 'if (rowParams.body)' doesn't always fail.

    If there is a better way that accomplishes the same task that does not hit this issue please let me know.

    Thanks,
    Ryan
  7. #7
    Hi Ryan,

    I cannot see such the code in the SVN trunk.
    if (rowParams.body) {
    Please clarify what is the Ext.NET version you are using?
  8. #8

    ext3 compatibility

    You are correct. We were still using the ext3 compatibility file and that had the offending code. This can be left as Closed.

    Thanks,
    Ryan

Similar Threads

  1. [CLOSED] How does "MaskCls" work for "AutoLoad" mask in panel control
    By leon_tang in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Jul 19, 2012, 1:09 PM
  2. Replies: 1
    Last Post: Jun 26, 2012, 12:29 PM
  3. Replies: 5
    Last Post: May 02, 2012, 6:37 PM
  4. Replies: 4
    Last Post: Oct 11, 2011, 3:42 AM
  5. Replies: 2
    Last Post: Jun 26, 2011, 2:59 AM

Posting Permissions