Results 1 to 3 of 3

Thread: Modifying one instance of a toolbar in a parent grid panel

  1. #1
    Sencha User
    Join Date
    Sep 2009
    Posts
    35
    Answers
    2

    Default Answered: Modifying one instance of a toolbar in a parent grid panel

    I have a custom toolbar that extends Ext.toolbar.Toolbar. This toolbar has a vbox container as it's only item. The vbox container, in turn, has two 'toolbar' children and each toolbar has some combos, checkboxes, datepickers etc. This gives me a nice two row toolbar class. I have a button in the second row which calls an event in the parent (ownerCt.fireEvent('name')). This means that whichever container instantiates this toolbar needs to define that event to do something when toolbar button is clicked.

    Now I instantiate this toolbar in two different grids.

    In one of the grids, I want to disable a couple of items, remove couple of items.

    I tried couple of things - First I added an 'id' to the specific items in toolbar that I need to remove in one of the grids. and then:
    Code:
    custombar = view.down('customtoolbar');
    custombar.remove(<id>);
    But that did not remove that item, instead I saw very strange behavior of item getting laid out twice, all jammed up in left side of the container!

    So I removed the 'id'. And now, I tried something as simple as:
    Code:
    custombar.remove(custombar.down('checkbox'));
    But this also does not remove the checkbox item. And even if it did, I have two checkboxes I need to remove, it would anyway remove the first one.

    Question - how can I instantiate a custom toolbar in different grids, and then add/remove/modify components in one of the grids as needed?

  2. Define some configs in your toolbar class and on config update change your toolbar as needed.

  3. #2
    Sencha User
    Join Date
    Apr 2013
    Posts
    913
    Answers
    105

    Default

    Define some configs in your toolbar class and on config update change your toolbar as needed.

  4. #3
    Sencha User
    Join Date
    Sep 2009
    Posts
    35
    Answers
    2

    Default

    Quote Originally Posted by hakimio View Post
    Define some configs in your toolbar class and on config update change your toolbar as needed.
    I actually used the viewModel and bindings to control basic things like disabling, hiding certain elements - this suits my purpose as of now, and works very neatly indeed.

    For more advanced instance specific things, using config variables sounds like a great idea! Thank you for showing me the light.

Similar Threads

  1. ExtJs 6 : How to get Parent grid Instance in tbar
    By Naresh_Reddy in forum Ext JS 6.x Q&A
    Replies: 3
    Last Post: 27 Mar 2016, 11:29 PM
  2. Replies: 1
    Last Post: 23 Oct 2013, 3:43 PM
  3. Replies: 2
    Last Post: 21 Jan 2012, 12:29 AM
  4. Insert panel between toolbar and NestedList for Parent Items
    By pensive612 in forum Sencha Touch 1.x: Discussion
    Replies: 0
    Last Post: 29 Apr 2011, 1:38 PM
  5. Make inner panel resize when toolbar of parent panel is hidden
    By blessan in forum Sencha Touch 1.x: Discussion
    Replies: 4
    Last Post: 6 Aug 2010, 3:31 AM

Tags for this Thread

Posting Permissions

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