Prevent input select parser from handling events from child rows #1399

Merged
merged 1 commit into from May 12, 2017

Conversation

Projects
None yet
2 participants
@andysleigh
Contributor

andysleigh commented May 12, 2017

Currently the input select parser is handling events from all rows within a table. It should not be handling events from child rows. When it does the call to updateCell fails as this does not expect to be called on child row cell. The fix is to return from the event handlers immediately if the row is a child row.

@Mottie Mottie merged commit a23e12a into Mottie:master May 12, 2017

@Mottie

This comment has been minimized.

Show comment
Hide comment
@Mottie

Mottie May 12, 2017

Owner

Thanks! I appreciate it!

Owner

Mottie commented May 12, 2017

Thanks! I appreciate it!

@Mottie

This comment has been minimized.

Show comment
Hide comment
@Mottie

Mottie May 12, 2017

Owner

Hey @andysleigh!

I ended up adding an option (ignoreChildRow) to enable or disable child row events and set it to false by default to maintain current behavior. Then I noticed using updateCell on child rows was causing a javascript error. Ugh. So, I've disabled triggering "updateCell" on child rows for now (in the core plugin) and I will work on an update this weekend.

Owner

Mottie commented May 12, 2017

Hey @andysleigh!

I ended up adding an option (ignoreChildRow) to enable or disable child row events and set it to false by default to maintain current behavior. Then I noticed using updateCell on child rows was causing a javascript error. Ugh. So, I've disabled triggering "updateCell" on child rows for now (in the core plugin) and I will work on an update this weekend.

@andysleigh

This comment has been minimized.

Show comment
Hide comment
@andysleigh

andysleigh May 12, 2017

Contributor

Hi @Mottie,

The error in updateCell is why I originally went about making this change. But from my understanding, we would never need to call updateCell for a child row cell, as these are not held in the internal cache, which is why I just disabled it altogether. Please let me know if I've missed something.

Contributor

andysleigh commented May 12, 2017

Hi @Mottie,

The error in updateCell is why I originally went about making this change. But from my understanding, we would never need to call updateCell for a child row cell, as these are not held in the internal cache, which is why I just disabled it altogether. Please let me know if I've missed something.

@Mottie

This comment has been minimized.

Show comment
Hide comment
@Mottie

Mottie May 12, 2017

Owner

The child rows are held in the cache along with the parent row. If you look at the cache for a parent row, you'll see this:

[
  "parent row 1 col 1",
  "parent row 1 col 2",
  {
    // jQuery object
    $row: [
      $parentRow,
      $childRow1,
      $childRow2
    ],
    // child row text (parsed)
    child: [
      [
        "child row 1 col 1",
        "child row 1 col 2"
      ],
      [
        "child row 2 col 1",
        "child row 2 col 2"
      ]
    ],
    // original parent row index (used when sort is reset)
    order: 0,
    // unparsed raw text content from the parent row
    raw: [
      "parent row 1 col 1",
      "parent row 1 col 2"
    ]
  }
]
Owner

Mottie commented May 12, 2017

The child rows are held in the cache along with the parent row. If you look at the cache for a parent row, you'll see this:

[
  "parent row 1 col 1",
  "parent row 1 col 2",
  {
    // jQuery object
    $row: [
      $parentRow,
      $childRow1,
      $childRow2
    ],
    // child row text (parsed)
    child: [
      [
        "child row 1 col 1",
        "child row 1 col 2"
      ],
      [
        "child row 2 col 1",
        "child row 2 col 2"
      ]
    ],
    // original parent row index (used when sort is reset)
    order: 0,
    // unparsed raw text content from the parent row
    raw: [
      "parent row 1 col 1",
      "parent row 1 col 2"
    ]
  }
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment