Data in option list are duplicated when using UrlAdaptor and custom values are allowed - urgent

Hello,

I have the problem that when the multiselect is set to allowCustomValues and gets data from UrlAdaptor (request on the controller action that returns JSON), returned data in option selector (dropdown) are duplicated (multiple times, resp. count of duplicates is equal to count of requests on keyUp).

As I discovered, every "keyUp" sends a request. Twice (same request twice per keyUp). But only, when is at least one of remote values added to input. Apparently here is the problem.

Can I ask for a hotfix? It is very urgent. I'm using your CDN so the change should take effect as soon as you fix it.

Thank you.

My code - view:

                    <ejs-multiselect id="[email protected]" name="SelectShareMails" placeholder="Add e-mails" allowCustomValue="true" mode="Box" zIndex="999999999">
                        <e-multiselect-fields text="Text" value="Value" id="Id"></e-multiselect-fields>
                        <e-data-manager url="@Url.Action("GetUserContacts", "Share")" adaptor="UrlAdaptor"></e-data-manager>
                    </ejs-multiselect>

Response from request:

[{"Id":1,"Text":"[email protected]","Value":"[email protected]"},{"Id":3,"Text":"[email protected]","Value":"[email protected]"},{"Id":4,"Text":"[email protected]","Value":"[email protected]"},{"Id":5,"Text":"[email protected]","Value":"[email protected]"},{"Id":6,"Text":"[email protected]","Value":"[email protected]"}]




3 Replies

PO Prince Oliver Syncfusion Team October 8, 2018 11:48 AM UTC

Hi Michael, 

Thank you for contacting Syncfusion support. 

We tried to replicate the reported issue in our end by binding data for MultiSelect component through UrlAdaptor and AllowCustom set to true. We were unable to replicate the issue, only one request is sent for each character during filtering. Please refer to the below screenshot. 

 

In the above screenshot, the request is sent twice for the 2 typed characters. Also, the filtered items are not repeated in our end. Please check whether the returned data is in correct format as shown below 
 
  public IActionResult Datasource([FromBody]DataManager dm) 
        { 
            
 
            var Data = OrdersDetails.GetAllRecords(); 
            int count = Data.Count(); 
            if (dm.skip != 0) 
                Data = Data.Skip(dm.skip).ToList(); 
            if (dm.take != 0) 
                Data = Data.Take(dm.take).ToList(); 
            if (dm.where != null) 
            { 
                Data = (from n in OrdersDetails.order where n.CustomerID.ToLower().Contains(dm.@where[0].value) select n).ToList(); 
            } 
                 
            return dm.requiresCounts ? Json(new { result = Data, count = count }) : Json(Data); 
        } 
 
We have attached sample for your reference, please find the sample at the following location:  
 
If the issue still persists in your end, kindly revert us by modifying the above sample to reproduce the issue. It will help us provide the solution at the earliest.  

Regards, 
Prince 



MF Michael Flendr October 8, 2018 03:32 PM UTC

Hello,

thank you for answer. However, based on your code, I fixed the problem, but not how it should be. I found that in order to avoid duplicate data, it is necessary to return an empty field response to each request, except for the first one (the first data load into MultiSelect).

n your code, you compared whether the CustomerID contains something that came in the request to Where. But in Where request was "@field" = "OrderID" and Value was an order ID, not a customer ID. Thus, the response was always a empty array. That's why you did not succeed in replicating the problem. See screenshot bug1.png. 

I've modified your code to compare the correct values and a duplication problem occurs again. See screenshot bug2.png and bug3.png. However, it was not a exactly same problem I originally reported. 

My problem was that it always returned the same data - and I think the problem is that old data is not replaced by new ones, but they are added. When you turn off "Where filtering", you can see bug i reported (see screenshot bug4.png). 

Repro:

        //replace old Datasource method to:

        public IActionResult Datasource([FromBody]DataManager dm)
        {                    
            var Data = OrdersDetails.GetAllRecords();
            int count = Data.Count();
     
            return dm.requiresCounts ? Json(new { result = Data, count = count }) : Json(Data);
        }



-----

I attach zip with modified code and screenshots.

Thanks for help.






Attachment: SF_Bug_b805a19a.zip


PO Prince Oliver Syncfusion Team October 9, 2018 12:49 PM UTC

Hi Michael, 

Thank you for your update. 

We could replicate the "duplicated values" issue from the shared information. We have considered this as a defect and the fix will be included in the upcoming patch release. 

Regards, 
Prince 


Loader.
Up arrow icon