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

Exception on search within TreeSelect. #3860

Open
LukaMajcenic opened this issue May 13, 2024 · 4 comments
Open

Exception on search within TreeSelect. #3860

LukaMajcenic opened this issue May 13, 2024 · 4 comments

Comments

@LukaMajcenic
Copy link

Describe the bug

Exception gets thrown when using search on TreeSelect component.

Steps to reproduce (please include code)

Use <TitleTemplate> fragment instead of Title attribute on <TreeNode> element to reproduce the issue.

<TreeSelect TItem="string" TItemValue="string"
			Style="width:100%;"
			@bind-Values="values"
			DropdownStyle="max-height:400px;overflow:auto;"
			Placeholder="Please select"
			AllowClear
			Multiple
			TreeDefaultExpandAll
			EnableSearch
			MatchedStyle="font-weight: bold">
	<TreeNode TItem="string" Key="parent 1" Title="parent 1">
		<TreeNode TItem="string" Key="parent 1-0" Title="parent 1-0">
			<TreeNode TItem="string" Key="leaf1" Title="my leaf" />
			<TreeNode TItem="string" Key="leaf2" Title="your leaf" />
		</TreeNode>
		<TreeNode TItem="string" Key="parent 1-1" Title="parent 1-1">
			<TreeNode TItem="string" Key="leaf3">
                            <TitleTemplate>
                                <b Style="color:#08c;">leaf3</b>
                            </TitleTemplate>
                        </TreeNode>
		</TreeNode>
	</TreeNode>
</TreeSelect>

Exceptions (if any)

object reference not set to an instance of an object

in Where.cs

Further technical details

  • AntDesign Nuget Package version: 0.19.0
  • .NET SDK version: 8.0.202
@LukaMajcenic
Copy link
Author

One workaround if you want to use <TitleTemplate> is to add Title as well.

<TreeNode TItem="string" Key="leaf3" Title="leaf3">
                            <TitleTemplate>
                                <b Style="color:#08c;">leaf3</b>
                            </TitleTemplate>
                        </TreeNode>

Unfortunatelly, this is not possible if generating using TreeData, making the TreeData feature UNUSABLE.

@LukaMajcenic
Copy link
Author

The problem is not present in 0.18.3

@ElderJames
Copy link
Member

Thanks for contacting us @LukaMajcenic , set the Title parameter is the right way for searching the node with TitleTemplate.

Did you want the TreeData also support TitleTemplate?

@LukaMajcenic
Copy link
Author

LukaMajcenic commented May 14, 2024

Did you want the TreeData also support TitleTemplate?

I'm not sure that would solve anything. The whole point of TreeData is to generate tree without the need for <TreeNode>.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants