Results 1 to 5 of 5

Thread: Ext.form.Panel: query vs. remove methods

  1. #1
    Sencha User
    Join Date
    Sep 2016
    Posts
    10

    Default Answered: Ext.form.Panel: query vs. remove methods

    First, I'm using ExtJs version 4.2.2.

    I have a panel and I call .query() on it, it finds the value that I'm querying for. However, if I then call .remove() on the panel, it doesn't find the item to remove, and therefore returns undefined.

    https://fiddle.sencha.com/#fiddle/1hpj

    What's going on, and how should I be handling this in my code? Is there a better way to remove the item?

    Thanks!

  2. Remove only removes direct children, so you need to call remove on the direct parent of the thing you want to remove.

  3. #2
    Sencha Premium User
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,258
    Answers
    759

    Default

    Remove only removes direct children, so you need to call remove on the direct parent of the thing you want to remove.

  4. #3
    Sencha User
    Join Date
    Sep 2016
    Posts
    10

    Default

    Thanks for the response. So, the query method queries all children?

    To remove a nested child, I should do something like this?

    parentPanel.items.items[0].remove(item, false);

  5. #4
    Sencha Premium User
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,258
    Answers
    759

    Default

    If you just want it to be destroyed, then just call item.destroy(). Otherwise, it would be simpler to use item.ownerCt.remove(item, false);

  6. #5
    Sencha User
    Join Date
    Sep 2016
    Posts
    10

    Default

    Perfect. That makes so much sense. I'm just new to ExtJs and have no clue what I'm doing. Appreciate the help!

Similar Threads

  1. Replies: 8
    Last Post: 20 Nov 2013, 1:21 PM
  2. Replies: 3
    Last Post: 29 Dec 2012, 10:18 PM
  3. [CLOSED] Component methods not available after Ext.ComponentQuery.query();
    By predator in forum Sencha Touch 2.x: Bugs
    Replies: 0
    Last Post: 19 Feb 2012, 12:31 PM
  4. Replies: 5
    Last Post: 20 Jul 2010, 6:40 AM
  5. add/remove QuickTips methods/functions
    By Nullity in forum Community Discussion
    Replies: 6
    Last Post: 10 Apr 2007, 6:17 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
  •