Results 1 to 3 of 3

Thread: SegmentedButton on DataItem : Stopping propagation of toggle event

  1. #1

    Default Answered: SegmentedButton on DataItem : Stopping propagation of toggle event

    Hi,

    I have a segmentedButton control on a dataItem row. I'm listening for itemtap on the DataView and loading the details screen in response. However, because the segmentedButton is on the dataItem, a tap/toggle on the segmentedButton triggers a itemtap on the DataView as well. This makes the segmentedButton control unusable (since any interaction with it loads the details screen).

    How do I cancel event propagation in the toggle event of the segmentedButton control?

  2. One option is to investigate the target of the tap. An example is shown in the fiddle below. You'll only access the details view if the tap occurs on an element who's className property does not contain "x-button".

    Regards,
    Brian

    https://fiddle.sencha.com/#fiddle/flc

  3. #2
    Sencha Premium User lumberjack's Avatar
    Join Date
    Nov 2014
    Location
    Kansas
    Posts
    781
    Answers
    102

    Default

    One option is to investigate the target of the tap. An example is shown in the fiddle below. You'll only access the details view if the tap occurs on an element who's className property does not contain "x-button".

    Regards,
    Brian

    https://fiddle.sencha.com/#fiddle/flc

  4. #3

    Default

    Perfect! This works, thank you.

    I was using a hack based on the width of the buttons (code below) but your suggestion is much cleaner.

    Hack I was using earlier:
    if ((dataview.element.getWidth() - e.pageX) < 90) // my buttons were to the right and 90 in width
    {
    return; // do nothing
    }

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
  •