We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

dropdownlistfor with remote data

Thread ID:

Created:

Updated:

Platform:

Replies:

142760 Feb 18,2019 03:49 PM UTC Mar 19,2019 06:08 AM UTC ASP.NET MVC - EJ 2 7
loading
Tags: DropDownList
Tomislav Tustonic
Asked On February 18, 2019 03:49 PM UTC

Hello

I'm trying to use a DropDownListFor with the remote data source, but I cannot make it work as I need to.
This is my DropDownListFor code

@(Html.EJS().DropDownListFor(m => m.ContactId)
            .DataSource(Model.ContactDataSource)
            .AllowFiltering(true)
            .Value(Model.ContactId)
            .Fields(new DropDownListFieldSettings { Value = "Id", Text = "LastName" })
            .Render())

On initial load, I'd like it to show a Contact name for the ContactId value from model (like it does for local data), and also to allow filtering remote data.

I looked at the DataManagerRequest in the Data source function, but the 'Where' value is empty on initial load.

Thanks, Tom



Prince Oliver [Syncfusion]
Replied On February 19, 2019 04:54 PM UTC

Hi Tomislav, 

Thank you for using Syncfusion products. 

Based on your shared code, we suspect that the issue might have occurred due to not assign model value and passing it to the view. Kindly ensure this in your end. we have attached a test sample based on your scenario for your reference, please find the sample at the following location: http://www.syncfusion.com/downloads/support/forum/142760/ze/DropDownListFor-1587309220.zip 

Kindly check the above sample and let us know if you still face any issues in your end.   

Regards, 
Prince 


Tomislav Tustonic
Replied On February 19, 2019 05:21 PM UTC

Hello

Thanks for the reply, but, unfortunately, this doesn't answer my problem.
1. There's no filtering enabled.
2. My data has >120000 entries, which is impossible to load at once. Your sample has all the entries loaded on startup.

I have modified your sample, changing the following:
1. changed the query, so that it doesn't load all the data:
ViewBag.query = "new ej.data.Query().select(['FirstName', 'EmployeeID']).take(2).requiresCount()"

2. Set the model.Value outside the initially loaded data:
model.Value = 9;

3. Added filtering to the definition of DropDownList

With these modification the sample doesn't work as expected. The desired result is that, when I load the page, the employee 9 (Steven Buchanan) is shown and selected in the DDL, but in the modified sample there's nothing selected in the DropDownList.

The changed sample is in the attachment.

Thanks, Tom



Attachment: DropDownListFor__Copy_a816431c.zip

Tomislav Tustonic
Replied On February 19, 2019 07:59 PM UTC

Hello

I think that I have a solution.
Here's my modified definition for a DDL:

@(Html.EJS().DropDownListFor(m => m.ContactId)
        .DataSource(Model.ContactDataSource)
        .AllowFiltering(true)
        .Value(Model.ContactId)
        .Fields(new DropDownListFieldSettings { Value = "Id", Text="LastName" })
        .Query("new ej.data.Query().select(['Id', 'LastName']).where('Id', 'equal','" + Model.ContactId.ToString() +"').requiresCount().take(5)")
        .Render())

This initially shows a correct Contact and allows to filter remote data and change selection.

Tom

Prince Oliver [Syncfusion]
Replied On February 20, 2019 06:25 AM UTC

Hi Tomislav, 

Thank you for your update. 

We have validated the issue in the shared modified sample. We are considering this as a defect in our EJ2 DropDownList control. The fix for this issue will be included in our upcoming patch release scheduled on next week. Meanwhile, you can now track the current status of your request, review the proposed resolution timeline, and contact us for any further inquiries through this link: https://www.syncfusion.com/feedback/4893/  

Regards, 
Prince   


Tomislav Tustonic
Replied On February 20, 2019 10:21 PM UTC

Thanks

Will there be a Nuget package for the update, or a new version for download, or what ?
BTW, link doesn't work.

Tom

Prince Oliver [Syncfusion]
Replied On February 21, 2019 11:20 AM UTC

Hi Tom, 

Thank you for the update. 

Yes, there will be new version available in the patch release and you need to upgrade your packages to the latest version. We have updated the feedback link, please check it now. 

Regards, 
Prince 


Prince Oliver [Syncfusion]
Replied On March 19, 2019 06:08 AM UTC

Hi Tom, 

Thank you for your patience. 

We have fixed the reported issue in our end and it is available in our 2019 Volume 1 beta release. kindly refer to the following release notes section: https://github.com/syncfusion/ej2-angular-ui-components/releases/tag/v17.1.32-beta  

Kindly upgrade the packages on your end to check the issue. Please let us know if you need any further assistance on this. 

Regards, 
Prince 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;