Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Sourcing]: fdp tree table on check of parent checkbox , child checkboxes should also be checked #9355

Closed
I543348 opened this issue Feb 8, 2023 · 7 comments · Fixed by #9672
Assignees
Labels
enhancement New feature or request in progress platform platform sourcing required for sourcing table
Milestone

Comments

@I543348
Copy link

I543348 commented Feb 8, 2023

Is this a bug, enhancement, or feature request?

Bug

Briefly describe your proposal.

On check of parent row's checkbox , the child rows should also automatically get checked until and unless user unchecks few of children rows

Which versions of Angular and Fundamental Library for Angular are affected? (If this is a feature request, use current version.)

angular 13
core / platform : 0.35.x

If this is a bug, please provide steps for reproducing it.

reproducible on https://sap.github.io/fundamental-ngx/#/platform/table#tree

Please provide relevant source code if applicable.

https://sap.github.io/fundamental-ngx/#/platform/table#tree

Is there anything else we should know?

This is a development blocker for guided sourcing
priority is A
Expecting a property from fdp-table which can be used to decide whether on check of "parent" row child rows should be checked or not - may be a boolean field.

@skaquib123 skaquib123 self-assigned this Feb 9, 2023
@skaquib123 skaquib123 added platform platform sourcing required for sourcing table labels Feb 10, 2023
@droshev droshev added the enhancement New feature or request label Feb 10, 2023
@skaquib123 skaquib123 removed their assignment Mar 8, 2023
@droshev
Copy link
Contributor

droshev commented Mar 15, 2023

This can be handled on the application side

@I543348
Copy link
Author

I543348 commented Mar 16, 2023

Hi @droshev , the guided sourcing tables can support until 2000 rows of data , hence it would be tedious way to make a check on each row's children and recursively check the checkboxes for child rows.
It might make our application really slow.

Hence it would be great if it can be handled from F-NGX platform tree table side

@fkolar
Copy link
Member

fkolar commented Mar 20, 2023

@mikerodonnell89 , @droshev, Let's agree before hand on the solution as this is cheaper than PR ;-)

I checked this one and there needs to be two type of changes:

1) Platform Table level

  • this checked, it should work similar way as expanded
  • _calculateCheckedAll, I am not sure how much this method consider if this tree table
  • Table should have also a selection state - but this would be another issue
  • This is going to be handled similar way as _toggleExpandableTableRow
    *CHANGE: In _toggleMultiSelectRow(): if we are dealign with a tree mark (checked=true/false) existing parents + children that are already loaded in Table
  • The selection state is kept private, DataSource has no way to tell the Table if something is selected.
  • When something is selected table emits even so app can do something, but app has no way tell tell the app to select something
  • Instead of keeping all these information on the level of TableRow which is internal, probably better to work with e.g.:
    -> Item -> BaseTableItem - TreeItem types and with this we would be able to keep the state. We already have this something similar on the level of comboxbox (OptionItem - SelectableOptionItem)

2) Application

  • Application should use checked state and and make sure for any new nodes, when expanded nodes are also checked.
  • I will extend existing tree-table example

I assume when we do a search, it needs to reset existing checked state.

@I543348
Copy link
Author

I543348 commented Mar 30, 2023

@mikerodonnell89 , @droshev, Let's agree before hand on the solution as this is cheaper than PR ;-)

I checked this one and there needs to be two type of changes:

1) Platform Table level

  • this checked, it should work similar way as expanded
  • _calculateCheckedAll, I am not sure how much this method consider if this tree table
  • Table should have also a selection state - but this would be another issue
  • This is going to be handled similar way as _toggleExpandableTableRow
    *CHANGE: In _toggleMultiSelectRow(): if we are dealign with a tree mark (checked=true/false) existing parents + children that are already loaded in Table
  • The selection state is kept private, DataSource has no way to tell the Table if something is selected.
  • When something is selected table emits even so app can do something, but app has no way tell tell the app to select something
  • Instead of keeping all these information on the level of TableRow which is internal, probably better to work with e.g.:
    -> Item -> BaseTableItem - TreeItem types and with this we would be able to keep the state. We already have this something similar on the level of comboxbox (OptionItem - SelectableOptionItem)

2) Application

  • Application should use checked state and and make sure for any new nodes, when expanded nodes are also checked.
  • I will extend existing tree-table example

I assume when we do a search, it needs to reset existing checked state.

@fkolar regarding point 2 on application - does this mean application has to check if parent checkbox is checked and based on that set the "checked" to true for child checkboxes?

@fkolar
Copy link
Member

fkolar commented Mar 30, 2023

We discussed this and above describe solution is right way to go.

  1. We are going to introduce TreeItem interface and extends existing logic
  • We can do this in more generic way to have TableItem, which can be also used in regular table (we will have the same problem)
public interface Partial<TableItem<T = any>> {
  checked: boolean;
  value: T;
    ...
  // All what we have on the TableRow and does not bellongs to TREE

}

public interface TreeItem extends  TableItem {
  expanded: boolean
  expandable: boolean
   children: Array< TreeItem >;
   ...

}

  1. It needs to also support current behavior and work directly with the date and only if we are dealing with TreeItem or TableItem we can apply this logic.
  2. We should also introduce different types of behavior :
  • When state changes also include child or parents (when child is checked, also check parent) - This should be default behavior.
  • When state changes don't do anything.
  1. Once checked and based on the Type, in the table level iterate over existing data and toggle checked state (child->parent, parent-> child)

  2. On the app level it will require to use this interface. This will also allow application to pass initial checked/unchecked state

@mikerodonnell89 mikerodonnell89 removed their assignment Apr 4, 2023
@fkolar
Copy link
Member

fkolar commented Apr 11, 2023

Update: We are going to simplify this and we will use existing Type TableRow, which needs to be converted to interface, and then we will be able to expose this interface to the DataSource.

@InnaAtanasova InnaAtanasova modified the milestones: Sprint 110, Sprint 111 Apr 14, 2023
@I543348 I543348 changed the title [Sourcing][Dev blocker]: fdp tree table on check of parent checkbox , child checkboxes should also be checked [Sourcing]: fdp tree table on check of parent checkbox , child checkboxes should also be checked Apr 21, 2023
@I543348
Copy link
Author

I543348 commented Apr 21, 2023

This issue can be taken up in next sprint , we are fine with this.
@droshev

Thanks,
Anusha

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request in progress platform platform sourcing required for sourcing table
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants