I am trying to understand how can provide sorting & filtering on a column of view model that was flattened.
VMAddress
addressid
street1
street2
countryid
CountryName
stateid
StateName
cityid
CityName
The Coulumns CountryName,StateName and CityName as flattened fro their respective table ( i.e Country.CountryName, State.StateName,City.CityName).
If i filter or sort on this columns nothing happens. since i don' have those fileds as column in the database.
How can shift the filter on the server to other columns ?
5 Answers, 1 is accepted
0
Hello Karamjit,
You should map the descriptor field names back to the original ones(CountryName - Country.CountryName) in order for the operations to work correctly.
Regards,
Daniel
Telerik
You should map the descriptor field names back to the original ones(CountryName - Country.CountryName) in order for the operations to work correctly.
Regards,
Daniel
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Karamjit
Top achievements
Rank 1
answered on 31 Jan 2014, 01:52 AM
Did not quite get it. Do you have some working example ?
0
Hello again,
What I meant was to convert the names of the fields that you are sorting and filtering on back to the correct ones for the underlying data. I am not sure if the example will be useful since I do not know how are you performing the operations or what server side technology are you using but I am attaching the Grid WCF CRUD code library project modified to map the fields back to the original ones before performing the sorting and the filtering on the server.
Regards,
Daniel
Telerik
What I meant was to convert the names of the fields that you are sorting and filtering on back to the correct ones for the underlying data. I am not sure if the example will be useful since I do not know how are you performing the operations or what server side technology are you using but I am attaching the Grid WCF CRUD code library project modified to map the fields back to the original ones before performing the sorting and the filtering on the server.
Regards,
Daniel
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Karamjit
Top achievements
Rank 1
answered on 04 Feb 2014, 05:33 PM
TO simplyfy the question. I am using Drop down on an a Foregin Key that is CountryID, the Dropdown is displaying the Name of Country
If i enable Sorting and filtering on this column, it is sorting and Filtering by CountryID, i want the Sorting and Filtering to done by CountryName.
Also i am using JQUERY(NO MVC). on the Server Side i am using WebAPI Odata. staying within the confinements of this technology i would like to see how to achieve that.
Combobox is using the following WebAPI method
public PageResult<Country> GetCountries(ODataQueryOptions<Country> options)
{
IQueryable results = options.ApplyTo(db.Countries);
return new PageResult<Country>(
results as IEnumerable<Country>,
Request.GetNextPageLink(),
Request.GetInlineCount());
}
If i enable Sorting and filtering on this column, it is sorting and Filtering by CountryID, i want the Sorting and Filtering to done by CountryName.
Also i am using JQUERY(NO MVC). on the Server Side i am using WebAPI Odata. staying within the confinements of this technology i would like to see how to achieve that.
Combobox is using the following WebAPI method
public PageResult<Country> GetCountries(ODataQueryOptions<Country> options)
{
IQueryable results = options.ApplyTo(db.Countries);
return new PageResult<Country>(
results as IEnumerable<Country>,
Request.GetNextPageLink(),
Request.GetInlineCount());
}
0
Hello,
In that case I can suggest to bind the column to the text field. It is also possible to replace the filter field names in the parameterMap function but the filter menu will still be using inputs and operators for the CountryID field type and not for Name.
Regards,
Daniel
Telerik
In that case I can suggest to bind the column to the text field. It is also possible to replace the filter field names in the parameterMap function but the filter menu will still be using inputs and operators for the CountryID field type and not for Name.
Regards,
Daniel
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!