Autocomplete -> inline editing

Hi - I have tried to copy the example for inline editing, and use autocomplete. 
1) When I delete the text in the textbox and start typing I get the old value, seperated with comma, is this an error? 



2) Then I delete the comma-value and start typing and I get suggested all the values in the context, but I want a Distinct list, not a long list with all the instances of the same value.




I cant seem to Distinct the data:  <GridColumns>
                    <GridColumn Field=@nameof(OrdersDetails.OrderID) HeaderText="Order ID" IsPrimaryKey="true" ValidationRules="@(new { required=true, number=true})" TextAlign="TextAlign.Right" Width="140"></GridColumn>
                    <GridColumn Field=@nameof(OrdersDetails.CustomerID) HeaderText="Customer Name" ValidationRules="@(new { required=true})" Width="150">
                        <EditTemplate>
                            <EjsAutoComplete ID="CustomerID" Value="@((context as OrdersDetails).CustomerID.Distinct())" DataSource="@GridData">
                                <AutoCompleteFieldSettings Value="CustomerID"></AutoCompleteFieldSettings>
                            </EjsAutoComplete>
                        </EditTemplate>
                    </GridColumn>
Do you have an example of distinct ?



5 Replies

RS Renjith Singh Rajendran Syncfusion Team February 25, 2020 09:29 AM UTC

Hi Soren, 

Thanks for contacting Syncfusion support. 

Query 1 : When I delete the text in the textbox and start typing I get the old value, seperated with comma, is this an error? 
We are not able to face the reported problem(Values(BOLID) in the textbox displays as comma separated). We have prepared a video demo showing the behavior, please download the video from the link below, 
 
If you are still facing difficulties, then kindly get back to us with the following details for better assistance, 
  1. Share the exact scenario/proper replication procedure.
  2. Share with us a video demo showing the problem you are facing.
 
Query 2 : but I want a Distinct list, not a long list with all the instances of the same value. 
We suggest you to set a Distinct List value as DataSource for the EjsAutoComplete component. We have prepared a sample based on this requirement, please download the sample from the link below, 
 
Please use the code below 
 
 
<EjsGrid DataSource="@Orders" Toolbar="@(new List<string>() { "Add", "Edit", "Delete", "Update", "Cancel" })" AllowPaging="true"> 
    <GridEditSettings AllowAdding="true" AllowDeleting="true" AllowEditing="true"></GridEditSettings> 
    <GridColumns> 
        ... 
        <GridColumn Field=@nameof(Order.CustomerID) HeaderText="Customer Name" ValidationRules="@(new { required=true})" Width="150"> 
            <EditTemplate> 
                <EjsAutoComplete ID="CustomerID" Value="@((context as Order).CustomerID)" DataSource="@OrdersDistinct"> 
                    <AutoCompleteFieldSettings Value="CustomerID"></AutoCompleteFieldSettings> 
                </EjsAutoComplete> 
            </EditTemplate> 
        </GridColumn> 
        ... 
    </GridColumns> 
</EjsGrid> 
 
@code{ 
    ... 
    protected override void OnInitialized() 
    { 
        Orders = Enumerable.Range(1, 75).Select(x => new Order() 
        { 
            OrderID = 1000 + x, 
            CustomerID = (new string[] { "ALFKI", "ANANTR", "ANTON", "BLONP", "BOLID" })[new Random().Next(5)], 
            ... 
        }).ToList(); 
        OrdersDistinct = Orders.GroupBy(o => new{o.CustomerID}).Select(o => o.FirstOrDefault()).ToList();  
    } 
    ... 
} 
 

Please get back to us if you need further assistance. 

Regards, 
Renjith Singh Rajendran. 



SM Soren M February 25, 2020 01:14 PM UTC

Thank you, works even with dropdowns. 
<GridColumn Field=@nameof(Order.CustomerID) HeaderText="Customer Name" DataSource="@BrandDistinct"  EditType="EditType.DropDownEdit" Width="150"> 


Another question, I found the example for changing the paging, 
<GridPageSettings PageCount="5" PageSize="@PageSize" CurrentPage="@CurrentPage" PageSizes="@PageSizes" />

But how do I change the values in the dropdown, if I want more that 20 and less than all? 




RS Renjith Singh Rajendran Syncfusion Team February 26, 2020 05:16 AM UTC

Hi Soren, 

We suggest you to set the value for the PageSizes property as a List of page size values instead of the Boolean(true). Please use the code below, 


<GridPageSettings PageSizes="@(new int[] {4, 5,10,12, 45, 50 })"></GridPageSettings> 
 

Please refer the notes section of the below documentation, 
 
Please refer the screenshot below, 

 

Please get back to us if you need further assistance. 

Regards, 
Renjith Singh Rajendran. 



SM Soren M February 26, 2020 07:52 AM UTC

Ohh off course - thats why the PageSizes is of type object

Thank you.



RS Renjith Singh Rajendran Syncfusion Team February 27, 2020 05:03 AM UTC

Hi Soren, 

Thanks for your update. 

We are glad to hear that our suggestion helped you in achieving your requirement. 

Please get back to us if you need further assistance. 

Regards, 
Renjith Singh Rajendran. 


Loader.
Up arrow icon