jQuery UI Widgets Forums TreeGrid How can I handle inline edit validation in jqxTreeGrid when parent totals must e

This topic contains 1 reply, has 2 voices, and was last updated by  admin 1 week, 5 days ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author

  • vitorio
    Participant

    Hi everyone, I am working on an internal admin dashboard with TreeGrid.

    I am currently trying to solve this: How can I handle inline edit validation in jqxTreeGrid when parent totals must equal sum of child values?

    So far, I verified this is not a CSS-only issue, but state gets out of sync after user interactions.

    What would be the cleanest way to implement this?


    admin
    Keymaster

    Hi vitorio,

    The cleanest approach is to validate at the data layer rather than relying only on the editor. In jqxGrid, you can use the cellvaluechanging or cellendedit events to intercept edits, recalculate the affected parent’s total, and compare it against the sum of its child rows. If the validation fails, either reject the edit by returning the old value (when using cellvaluechanging) or immediately revert the cell value with setcellvalue after displaying a validation message. Keeping all aggregate calculations in a single validation function helps avoid duplicated logic and ensures the grid state remains consistent after sorting, filtering, or other user interactions. If parent totals are derived values, it’s often even cleaner to calculate them automatically from the children instead of allowing users to edit them directly.

    Regards,
    Peter

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.