-
Notifications
You must be signed in to change notification settings - Fork 152
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
Nested CollectionField Data #457
Comments
Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible. |
@edarroudi Is this available for use? |
@walleford not right, PR has to be looked at and then finished. Can't give you a timeline on that. |
I see @edarroudi until then do you happen to know of a way to conditionally render a field within the collection field data? I have tried Boolean && {field element} as well as using (…{} : {}) for determine whether something is true and rendering an object based on that. |
@walleford I just managed to create several levels of nested PropertyFieldCollectionDataHost. I don't know if it is what you are looking for but maybe it helps you along: |
@IRRDC Thank you for that, it is really appreciated. This is what I have gotten to so far,
However, I can't seem to get the value of the custom rendered field collection data to work properly, I don't really know what to set it as. I am also wanting to us isVisible to make it available based on whether another field within the top level collection data is checked or not, but haven't been able to get that to work either. Let me know if you have any suggestions! |
Do you specifically want to access the first item here? this.properties.gridItems[0].dropData The gridItems collection will only have updated values once the control closes. To access the gridItem that matches the current row you can refer to the "item" property of the surrounding collection (just rename the inner "item" as I did in my badly formatted example to "subitem" to distinguish them). That surrounding "item" instance will have the (as yet unsaved) current value of the topmost collection. |
@IRRDC so when you used subItem: IListConfig, this is allowing the nested fields to reference their parent row? What I sent you above is a single field within the collection data, that is custom rendering another collection data group. Just want to make sure I am tracking what you are saying correctly. |
Yes, you are nesting to custom renders, each with a signature of (field, value, onUpdate, item, itemId, onError). If you change the parameter names in the signature of the nested custom renders you can refer to the parent field, value, etc. The "item" parameter of the parent contains the parent row value that is currently being edited. |
I see, thank you for that. Would this also theoretically work for referencing another field in the parent collection?
I want dropData to reference isDropdown to determine whether or not it should render, or be available I guess. |
Yes. In your code snippet you have to change |
@IRRDC wow, thanks. This should help me almost finish lol. Now to the tsx and actually rendering everything correctly |
@IRRDC However, when I use it this way:
I am getting an error on item.isDropdown saying it can't be found. If the parent isn't a "Custom collection field" rather a regular PropertyFieldCollectionData, will item reference it properly? |
Sorry, I was thinking in too many nested layers just then. The code I'm working on right now is messing with my head. You don't need to rename item, set value: item.dropData, and disabled: item.isDropdown ? false : true. |
@IRRDC One last question for you, how are you getting the nested items to persist after clicking add and save? I am using this onChanged function (which works in a non-nested field) but it isn't working for this nested fieldcollectiondata. I would appreciate any help you can give.
|
@walleford I'm just using |
@IRRDC thank you for all of the help, I am going to close this now because that solved the issue. |
@IRRDC hello again... I had to rewrite this code... long story short, backups didn't happen so I lost it. I am pretty sure I wrote it the exact same way, but it isn't persisting after I click add and save and I am not sure why, do you see anything wrong with this?
|
@walleford I'm sorry but I don't see what is wrong with your code. |
@walleford - I assume the question was more or less answered and the issue could be closed. |
This issue has been automatically marked as stale because it has marked as requiring author feedback but has not had any activity for 7 days. It will be closed if no further activity occurs within next 7 days of this comment. Thank you for your contributions to SharePoint Developer activities. |
Closing issue due no response from original author. If this issue is still occurring, please open a new issue with additional details. Notice that if you have included another related issue as additional comment on this, please open that also as separate issue, so that we can track it independently. |
Category
Version
Please specify what version of the library you are using: [ 3.6.0 ]
Expected / Desired Behavior / Question
If you are reporting an issue please describe the expected behavior. If you are suggesting an enhancement please
describe thoroughly the enhancement, how it can be achieved, and expected benefit. If you are asking a question, ask away!
Hello,
I am trying to nest a collection data inside another collection data that renders only when one of the fields in the original collection data is checked. Is there a way to do this?
I have this below but it does not work so far:
I would really appreciate any help with this! Thank you.
The text was updated successfully, but these errors were encountered: