Results 1 to 3 of 3

Thread: To shift focus from one normal gridpanel to property grid

  1. #1

    Default To shift focus from one normal gridpanel to property grid

    Hi,

    I have 2 grids namely a normal grid panel more like a help list which describes various properties. If i click on a specific property it should actually shift the focus from this grid to a property grid and select/ highlight that property. I am able to scroll to the property in the property grid but not able to highlight it..

    Code:
    function helpList_clickHanlder(grid, rowIndex,columnIndex,e)
            {
                var record = grid.getStore().getAt(rowIndex);
                var field = grid.getColumnModel().getDataIndex(columnIndex); 
                if (field == 'editIcon')
                {
                    var property = record.get('fieldName');
                    var type = record.get('fieldType');
                    if (type == 'Header')
                    {
                        
                        Portal.User.focusProperty(localRef.headerDefaultsList,property);
                        localRef.headerDefaultsList.focus();
                        return;
                    }
                    else if (type == 'Line')
                    {
                        Portal.User.focusProperty(localRef.lineDefaultsList,property);
                    }                
                }            
            }
    Portal.User.focusProperty = function(grid, propertyName)
    {
        for ( var i=0; i<grid.store.getCount();i++)
        {
            var record = grid.getStore().getAt(i);
            var prop = record.get('name');
            //console.debug(propertyName);
            
            if (propertyName == prop)
            {
                grid.getView().focusEl.focus(true);
                //grid.focus(propertyName);
                grid.getSelectionModel().select(i);
                grid.getView().focusRow(i);
                var row = grid.getView().getRow(i)
                grid.getView().getRowStyle = function(record, rowIndex, rp, ds){ rp.bodyStyle = 'test';return 'test';}
                //grid.startEditing(i,1);
                
            }
        }
    }
    Any help on this would be highly appreciated. Thanks!!

  2. #2
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,890

    Default

    selecting a Record will highlight a row!

    And there are built in ways of finding a record in a Store. You do not have to write a loop (which continues looping even after it finds the target!)

  3. #3

    Default

    Animal..Thanks a lot for your pointers..I removed the loop and used jsonstore's built-in functions and voila! it works..Just posting the code for others reference
    Code:
    Portal.User.focusProperty = function(grid, propertyName)
    {
        var j = grid.getStore().findExact('name',propertyName);
        grid.getSelectionModel().select(j,0,false,false,j);
    }

Similar Threads

  1. Ctrl+Shift+Mousedown on Gridpanel do dirty selection in ie
    By yhwh in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 9 Aug 2010, 6:39 AM
  2. pop-up and parent focus shift problem
    By czar_RAM in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 4 Mar 2009, 12:22 AM
  3. Focus shift on click of enter in search text created as component
    By kckc1234 in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 10 Sep 2008, 7:58 PM
  4. IE Shift click problem in Gridpanel
    By yhwh in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 4 Jun 2008, 6:02 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •