Emptying autocomplete fails and NoRecordsTemplate produces exception
Hi,
version is 17.4.46.
A)
the autocomplete must be emptied by a button action OnReset.
This works only once. Every following attempt fails: the content is not emptied. he variable TheValue shows its emptied after reset, but the control is not updated. Databinding is configured in dynamic way.
<EjsAutoComplete Value="@TheValue"
TValue="string"
DataSource="@Source" >
<AutoCompleteFieldSettings Value="Name" Text="Name"></AutoCompleteFieldSettings>
<AutoCompleteEvents TValue="string" ValueChange="OnChange"></AutoCompleteEvents>
</EjsAutoComplete>
private void OnChange(Syncfusion.EJ2.Blazor.DropDowns.ChangeEventArgs<string> args)
{
TheValue = args.Value;
StateHasChanged();
}
private void OnReset()
{
TheValue = string.Empty;
StateHasChanged();
}
B)
Another annoying thing: inserting a no data template results in an exception instead showing the template:
<EjsAutoComplete Value="@TheValue"
TValue="string"
DataSource="@Source" >
<AutoCompleteFieldSettings Value="Name" Text="Name"></AutoCompleteFieldSettings>
<AutoCompleteEvents TValue="string" ValueChange="OnChange"></AutoCompleteEvents>
<AutoCompleteTemplates>
<NoRecordsTemplate>
<span> NO DATA AVAILABLE</span>
</NoRecordsTemplate>
</AutoCompleteTemplates>
</EjsAutoComplete>
Error: System.ArgumentNullException: Type cannot be null. (Parameter 'type')
at System.Runtime.CompilerServices.RuntimeHelpers.GetUninitializedObject(Type type)
at Syncfusion.EJ2.Blazor.BaseComponent.GetObject(Dictionary`2 Data, Type ModelType)
at Syncfusion.EJ2.Blazor.DropDowns.AutoCompleteTemplates.BuildRenderTree(RenderTreeBuilder __builder)
at Microsoft.AspNetCore.Components.ComponentBase.<.ctor>b__6_0(RenderTreeBuilder builder)
at Microsoft.AspNetCore.Components.Rendering.ComponentState.RenderIntoBatch(RenderBatchBuilder batchBuilder, RenderFragment renderFragment)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.RenderInExistingBatch(RenderQueueEntry renderQueueEntry)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.ProcessRenderQueue()
Any ideas? Thanks.
SIGN IN To post a reply.
7 Replies
BC
Berly Christopher
Syncfusion Team
February 3, 2020 01:14 PM UTC
Hi Axel,
Greetings from Syncfusion support.
Query 1:
the autocomplete must be emptied by a button action OnReset.
This works only once. Every following attempt fails: the content is not emptied. he variable TheValue shows its emptied after reset, but the control is not updated.
Response:
You can achieve the requested requirement by using bind-value attribute. While using this attribute, provided actions will be done on first time execution. We have already logged this as issue at our end and the fix will be available on this week patch release. Which is expected to be rolled out on February 5th, 2020. We appreciate your patience until then.
You can track the status of the bug in the below feedback link from below.
Query 2:
Another annoying thing: inserting a no data template results in an exception instead showing the template:
Response:
We need to define the ModelType for the MultiSelect component while using template option in your application. Please refer the below code example to get rid of the reported issue at your end.
|
@using Syncfusion.EJ2.Blazor.DropDowns
<EjsAutoComplete TValue="string" ModelType="@models" Placeholder="Select a customer" DataSource="@Country">
<AutoCompleteTemplates>
<NoRecordsTemplate>
<span class='norecord'> NO DATA AVAILABLE</span>
</NoRecordsTemplate>
</AutoCompleteTemplates>
<AutoCompleteFieldSettings Value="Name"></AutoCompleteFieldSettings>
</EjsAutoComplete>
@code {
Type models = typeof(EmployeeData);
public class EmployeeData
{
public string Name { get; set; }
}
public EmployeeData Data = new EmployeeData();
public class Countries
{
public string Name { get; set; }
public string Code { get; set; }
}
List<Countries> Country = new List<Countries>
{
new Countries() { Name = "Australia", Code = "AU" },
new Countries() { Name = "Bermuda", Code = "BM" },
new Countries() { Name = "Canada", Code = "CA" },
new Countries() { Name = "Cameroon", Code = "CM" },
new Countries() { Name = "Denmark", Code = "DK" },
};
} |
Please find the sample from the below link.
Sample Link: https://www.syncfusion.com/downloads/support/forum/151153/ze/Syncfusion_Autocomplete_151153-1628124465
Regards,
Berly B.C
SP
Sureshkumar P
Syncfusion Team
February 6, 2020 10:00 AM UTC
Thanks for the patience.
We are glad to announce that our latest release in the version 17.4.47 has been rolled out successfully and in that release, we have included the “Two Way Binding Is Not Updating After First Selection”. So, we suggest you upgrade our Syncfusion packages to our latest version to resolve this issue in your end.
Scripts:
Themes:
Please find the release notes details from the below link.
Regards,
Sureshkumar P
Sureshkumar P
AX
axl
February 8, 2020 11:17 AM UTC
Thanks, that helped.
If you want to inform your documentation team colleagues: there is an error within autocomplete/templates docu. Within example code there is a instance of the model class passed as argument to ModelType and not a type as in your correct example.
<EjsAutoComplete TValue="string" ModelType="@Data" Placeholder="Select a customer" DataSource="@Country">
<AutoCompleteTemplates>
<NoRecordsTemplate>
<span class='norecord'> NO DATA AVAILABLE</span>
</NoRecordsTemplate>
</AutoCompleteTemplates>
<AutoCompleteFieldSettings Value="Name"></AutoCompleteFieldSettings>
</EjsAutoComplete>public EmployeeData Data = new EmployeeData();
AX
axl
February 8, 2020 11:33 AM UTC
One more thing: is it possible to supress any no record dropdown because I just think it's meaningful enough that no entries are displayed?
SP
Sureshkumar P
Syncfusion Team
February 10, 2020 10:15 AM UTC
Hi Axel,
Query 1:
If you want to inform your documentation team colleagues: there is an error within autocomplete/templates docu. Within example code there is a instance of the model class passed as argument to ModelType and not a type as in your correct example.
Response:
We will change and refresh the documentation with Volume 1 Main release.
Query 2:
One more thing: is it possible to supress any no record dropdown because I just think it's meaningful enough that no entries are displayed?
Response:
We have provided this for intimating the user to no more data available data in the provide key search. We can restrict by close the popup if search count will be 0 as mentioned below.
|
@using Syncfusion.EJ2.Blazor.DropDowns
@using Newtonsoft.Json
<EjsAutoComplete @ref="AutoObj" TValue="string" ModelType="@models" Placeholder="Select a customer" DataSource="@Country">
<AutoCompleteTemplates>
<NoRecordsTemplate>
<span class='norecord'> NO DATA AVAILABLE</span>
</NoRecordsTemplate>
</AutoCompleteTemplates>
<AutoCompleteFieldSettings Value="Name"></AutoCompleteFieldSettings>
<AutoCompleteEvents TValue="string" OnActionComplete="OnAction"></AutoCompleteEvents>
</EjsAutoComplete>
@code {
EjsAutoComplete<string> AutoObj;
Type models = typeof(EmployeeData);
public class EmployeeData
{
public string Name { get; set; }
}
public EmployeeData Data = new EmployeeData();
public class Countries
{
public string Name { get; set; }
public string Code { get; set; }
}
List<Countries> Country = new List<Countries>
{
new Countries() { Name = "Australia", Code = "AU" },
new Countries() { Name = "Bermuda", Code = "BM" },
new Countries() { Name = "Canada", Code = "CA" },
new Countries() { Name = "Cameroon", Code = "CM" },
new Countries() { Name = "Denmark", Code = "DK" },
};
public void OnAction(Syncfusion.EJ2.Blazor.DropDowns.ActionCompleteEventArgs args)
{
var json = JsonConvert.DeserializeObject<List<Countries>>(args.Result.ToString().Replace("\r\n", "")).Count;
if(json == 0)
{
this.AutoObj.HidePopup();
}
}
} |
Please find the modified sample from below.
Sample Link: https://www.syncfusion.com/downloads/support/forum/151153/ze/Syncfusion_Autocomplete_151153_notemplate648782873
Regards,
Sureshkumar P
AX
axl
February 27, 2020 05:22 PM UTC
Thank you.
For supressing a no record message an property like SupressNoRecordHint would be nice. :)
BC
Berly Christopher
Syncfusion Team
February 28, 2020 08:51 AM UTC
Hi Axel,
Thanks for providing information.
We will check the possibilities to add this support “For supressing a no record message an property like SupressNoRecordHint” in our source implementation and we will add if it is valid in any one of our upcoming releases.
Regards,
Berly B.C
SIGN IN To post a reply.
- 7 Replies
- 3 Participants
-
AX axl
- Feb 1, 2020 03:00 PM UTC
- Feb 28, 2020 08:51 AM UTC