1. #1
    Sencha User
    Join Date
    May 2011
    Posts
    4
    Vote Rating
    0
    Trakcil is on a distinguished road

      0  

    Default Modal Buttons in Grid

    Modal Buttons in Grid


    I'm trying to add buttons to my grid, which will open up a modal window. I have buttons in my grid that alert the row index and I have a button outside of my grid, which can open a modal but I can't seem to get the grid buttons to open the modal. I tried adding the window creation to the actioncolumn's handler but that's not doing it.

    Code:
    {
    	                xtype: 'actioncolumn',
    	                width: 50,
    	                items: [{
    	                    icon   : 'assets/ext-4.0.0/resources/themes/images/default/button/arrow.gif',  // Use a URL in the icon config
    	                    tooltip: 'Sell stock',
    	                    handler: function(grid, rowIndex, colIndex) {
    	                        //var rec = store.getAt(rowIndex);
    	                       Ext.create('widget.window', {
    				                title: 'Layout Window',
    				                closable: true,
    				                closeAction: 'hide',
    				                //animateTarget: this,
    				                width: 600,
    				                height: 350,
    				                layout: 'border',
    				                bodyStyle: 'padding: 5px;',
    				                items: [{
    				                    region: 'west',
    				                    title: 'Navigation',
    				                    width: 200,
    				                    split: true,
    				                    collapsible: true,
    				                    floatable: false
    				                }, {
    				                    region: 'center',
    				                    xtype: 'tabpanel',
    				                    items: [{
    				                        title: 'Bogus Tab',
    				                        html: 'Hello world 1'
    				                    }, {
    				                        title: 'Another Tab',
    				                        html: 'Hello world 2'
    				                    }, {
    				                        title: 'Closable Tab',
    				                        html: 'Hello world 3',
    				                        closable: true
    				                    }]
    				                }]
    				            });
    	                        //alert(rowIndex);
    	                    }
    	                }]
    	            }
    Any tips?

    One other quick thing. What's the best way to fill the tab's html elements? Can I write a page and then just pass in a path? Are there any good examples of that out there?

  2. #2
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,508
    Vote Rating
    58
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    Are you sure it's a good idea to have an inline functoin?

    Shouldn't the handler be a member function. a reference to which get embedded in the column definition object in the method which defines the columns like

    Code:
        getColumnDefinition: function() {
            return ....
            ,{
                xtype: 'actioncolumn',
    	    width: 50,
    	    items: [{
    	        icon   : 'assets/ext-4.0.0/resources/themes/images/default/button/arrow.gif',  // Use a URL in the icon config
    	        tooltip: 'Sell stock',
    	        handler: this.sellStock,
                    scope: this
    ....

    And you need to show the Window.

  3. #3
    Sencha User
    Join Date
    May 2011
    Posts
    4
    Vote Rating
    0
    Trakcil is on a distinguished road

      0  

    Default


    Lol, yea. Just forgot to show it. Thanks.

    I'm planning on moving the function. Just had it there for convenience at the time.

    On a semi-related note, what would be the best way to make it so that this button only shows up ever x rows as opposed to them all?

    I'm also still trying to get the URL property to work. I would think that I just need to replace html: with url: followed by a relative page path. When I do that, however it's just blank.

  4. #4
    Sencha User
    Join Date
    May 2011
    Posts
    4
    Vote Rating
    0
    Trakcil is on a distinguished road

      0  

    Default


    I've tried it now with a relative path, a full physical path and a web one, however none of them seem to be getting accessed

Similar Threads

  1. Replies: 2
    Last Post: 27 Apr 2010, 7:59 AM
  2. [CLOSED] Sample modal window in tutorials is not modal.
    By janusmccarthy in forum Ext 3.x: Bugs
    Replies: 2
    Last Post: 19 Apr 2010, 7:46 AM
  3. [Solved]Message Box (modal) or Modal window - Bound to tabpanel??
    By EXT-Phuket in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 14 Apr 2009, 7:22 PM
  4. Modal Overlay Covers Modal Window Too..
    By djfiii in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 21 Mar 2008, 10:09 AM

Thread Participants: 1