Hi all... new to Syncfusion and yes, loving it.
I do have a problem that I just can't seem to figure out and need some help. I'm doing a simple (what seems simple to me) autocomplete using the web api with the webapiadapter. Here's the rub: I laid in the url and what I think or thought were the data elements but get absolutely nothing. Here's the url as you can see when you go to it in your browser it works fine: https://rxnav.nlm.nih.gov/REST/Prescribe/drugs.json?name=cymbalta
It's probably standing right in front of me looking right at me! Any help is most appreciated.
Thanks in advance,
J
------- Code --------
@page "/autocomplete-features" @using Syncfusion.Blazor @using Syncfusion.Blazor.DropDowns @using Syncfusion.Blazor.Data <h2>AutoComplete</h2> <br /> <div id="ControlRegion"> <div class="control-section"> <div id='remote-data'> <h4>Remote Data</h4> <SfAutoComplete TValue="string" TItem="RxDetails" Placeholder="Select a name" Query="@RemoteDataQuery" Autofill="true"> <SfDataManager Url="https://rxnav.nlm.nih.gov/REST/Prescribe/drugs" CrossDomain="true" Adaptor="Syncfusion.Blazor.Adaptors.WebApiAdaptor"> </SfDataManager> <AutoCompleteFieldSettings Text="name" Value="name"> </AutoCompleteFieldSettings> </SfAutoComplete> </div> </div> </div> <label>Api example with results..</label> <a rel='nofollow' href="https://rxnav.nlm.nih.gov/REST/Prescribe/drugs?name=cymbalta" target="_blank">https://rxnav.nlm.nih.gov/REST/Prescribe/drugs?name=cymbalta</a> <style> #remote-data { width: 35%; margin: 0 auto; padding: 3%; } .ulstyle { margin: 0px; padding-left: 20px; display: inline-block; } .list { float: left; line-height: 20px; margin: 10px; min-width: 330px; } </style> @code{ public Query RemoteDataQuery = new Query().From("drugGroup").Select(new List<string> { "name" }).Take(6).RequiresCount(); public class RxDetails { public int? rxcui { get; set; } public string name { get; set; } public string synonym { get; set; } } }
<SfAutoComplete TValue="string" TItem="OrderDetails" Placeholder="Select a name" Query="@Query">
<SfDataManager Url="https://ej2services.syncfusion.com/production/web-services/api/Orders" Adaptor="Syncfusion.Blazor.Adaptors.WebApiAdaptor" CrossDomain=true></SfDataManager>
<AutoCompleteFieldSettings Value="CustomerID"></AutoCompleteFieldSettings>
</SfAutoComplete>
@code {
public Query Query = new Query().Select(new List<string> { "CustomerID" }).Take(6).RequiresCount();
public class OrderDetails
{
public int? OrderID { get; set; }
public string CustomerID { get; set; }
public int? EmployeeID { get; set; }
public double? Freight { get; set; }
public string ShipCity { get; set; }
public bool Verified { get; set; }
public DateTime? OrderDate { get; set; }
public string ShipName { get; set; }
public string ShipCountry { get; set; }
public DateTime? ShippedDate { get; set; }
public string ShipAddress { get; set; }
}
} |