- Home
- Forum
- ASP.NET MVC - EJ 2
- dropdownlistfor with remote data
dropdownlistfor with remote data
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
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
SIGN IN To post a reply.
7 Replies
PO
Prince Oliver
Syncfusion Team
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
TT
Tomislav Tustonic
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
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
TT
Tomislav Tustonic
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
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
PO
Prince Oliver
Syncfusion Team
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
TT
Tomislav Tustonic
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
Will there be a Nuget package for the update, or a new version for download, or what ?
BTW, link doesn't work.
Tom
PO
Prince Oliver
Syncfusion Team
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
PO
Prince Oliver
Syncfusion Team
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
SIGN IN To post a reply.
- 7 Replies
- 2 Participants
-
TT Tomislav Tustonic
- Feb 18, 2019 03:49 PM UTC
- Mar 19, 2019 06:08 AM UTC