[CLOSED] GridView GetRowClass: not working with RowExpander plugin

  1. #1

    [CLOSED] GridView GetRowClass: not working with RowExpander plugin

    Hi,
    simple as that. When using the RowExpander plugin, the GetRowClass is not applied to the rows.
    Last edited by Daniil; Nov 05, 2010 at 3:45 PM. Reason: [CLOSED]
  2. #2
    Hi,
    if this takes time to be solved, i'm looking for any hints to a workaround for what i'm trying to achive.

    I have a grid with the row-exapnder.
    Each row, when expanded, contains another gridpanel.
    I need to do Drag&Drop on the rows of the main gridPanel.

    I'd like to have a custom class so i have a specific selector for the getTargetFromEvent() :
                getTargetFromEvent: function (event) {
                    return event.getTarget('droppable-row');
                }
    In this way i avoid to select the inner rows instead of the ones in the main grid.

    Thanks ;)
  3. #3
    Hi capecod,

    Yes, RowExpander overrode the getRowClass method.

    You could override it one more time in according to your requirements.

    Example
    <style type="text/css">
        .myClass {
            color: Red;
        }
    </style>
    
    <ext:ResourcePlaceHolder runat="server" Mode="Script" />
        
    <script type="text/javascript">
        Ext.grid.RowExpander.override({
            getRowClass: function(record, rowIndex, p, ds) {
                p.cols = p.cols - 1;
                var content = this.bodyContent[record.id];
    
                if (!content && !this.lazyRender) {
                    content = this.getBodyContent(record, rowIndex);
                }
    
                if (content) {
                    p.body = content;
                }
    
                return this.state[record.id] ? "x-grid3-row-expanded myClass" : "x-grid3-row-collapsed myClass";
            }
        });
    </script>
    Here is the original code:
    getRowClass: function(record, rowIndex, p, ds) {
        p.cols = p.cols - 1;
        var content = this.bodyContent[record.id];
    
        if (!content && !this.lazyRender) {
            content = this.getBodyContent(record, rowIndex);
        }
    
        if (content) {
            p.body = content;
        }
    
        return this.state[record.id] ? "x-grid3-row-expanded" : "x-grid3-row-collapsed";
    }
  4. #4
    I solve it in another way.

    On the AfterRender Listener of the main GridPanel:
                ovverideRowClass: function (item) {
                    var rowExpander = item.getRowExpander();
                    var getRowClass = rowExpander.getRowClass.createDelegate(rowExpander);
                    item.view.getRowClass = function (record, rowIndex, p, ds) {
                        return getRowClass(record, rowIndex, p, ds) + " droppable-row";
                    };
                },
    In this way afftects only this specific RowExpander.

Similar Threads

  1. [CLOSED] GridView GetRowClass and RowExpander conflict?
    By Ben in forum 1.x Legacy Premium Help
    Replies: 8
    Last Post: Dec 08, 2011, 2:39 PM
  2. Replies: 2
    Last Post: Nov 04, 2011, 6:06 PM
  3. Replies: 1
    Last Post: Mar 09, 2010, 2:57 PM
  4. [CLOSED] GridPanel RowExpander Plugin
    By Timothy in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Sep 12, 2008, 7:10 PM
  5. [CLOSED] GridView GetRowClass Args Property
    By Timothy in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Sep 07, 2008, 3:44 PM

Tags for this Thread

Posting Permissions