Results 1 to 2 of 2

Thread: trying to understand lastParent variable in FieldCell

  1. #1
    Sencha Premium Member
    Join Date
    Jul 2012
    Vote Rating

    Default trying to understand lastParent variable in FieldCell

    Hi, I'm diving into the Sencha code trying to understand the ComboBoxCell. I came across the lastParent variable thats declared in the FieldCell. Can someone from Sencha explain its use and whats it for?

    maybe an explanation of what its actually representing, like what XElement?

  2. #2
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Vote Rating


    Cells are designed to be drawn more than once, such as per-row in a grid or per-node in a tree. In a field, they are drawn exactly once, and directly map to the elements that are present in that single widget, but in the other cases there could be many simultaneous copies rendered at once. This is the main point, and benefit, of the Cell API. As a result of this, many calls must have some specific details about where the event is taking place - the Context gives a reference to the row/column/key of the current edited data, the parent Element gives the root of the currently used rendered copy of the cell, and the ValueUpdater gives a way to modify that particular rendered node's value.

    FieldCell tracks all three as lastParent, lastContext, lastValueUpdater. A saveContext call can be made to stash those values away, while clearContext nulls them out. These are presently only used for various TriggerFieldCell subtypes, where dom 'focus' and 'blur' can be somewhat ambiguous, and it is necessary to track events *outside* the cell itself but still update the currently focused cell.

    For example, take a DateCell rendered in a Grid's ColumnConfig. The user clicks on the cell, focusing it, then clicks the tool icon, bringing up a DatePicker widget, drawn outside yet on top of the grid. The dom focus leaves the DateCell and the Grid entirely at this time, but that original cell in the grid is still logically focused, as the user is using the DatePicker to select some value. So when the DatePicker has made a change, it need to inform the DateCell that it should change to a new value, and to do that, it needs to know which ValueUpdater to call, and which Element (or XElement) to re-render with the new value.

Posting Permissions

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