Telerik Forums
UI for ASP.NET MVC Forum
1 answer
8 views

Hi I'm attempting to repeat a vehicle (year/make/model) set of cascading dropdown lists in a component that would result in up to 3 vehicle selectors on the same form. Running into issues as the ddls have the same ids. I've been playing around with appending counters to the name etc but running into the issue where the last set of ddls gets the data. Wondering

1. If there is a working example of this scenario

2. If it is possible to pass a value to the filter function

 

Thanks.

Anton Mironov
Telerik team
 answered on 09 Apr 2024
0 answers
17 views

I had a request to change the filtering of a certain column from "Starts With" to use a multi-select checkbox type filter to facilitate selecting 5-10 random items.  Then of course some other users prefer the "Starts With" type of filtering.  My solution is to have dual columns for that particular field, one with each filter type.  

Since my grids save user preferences in local storage between sessions, the users can hide whichever column has the filtering they don't prefer and just use the other one.  When they reload the page, their choice of column persists and their filtering is how they like it.

Darron

 

 

Darron
Top achievements
Rank 1
 asked on 18 Mar 2024
0 answers
28 views

I am using a Kendo.Filter object like the following to filter results in a Kendo Grid:

@(Html.Kendo().Filter<CustomPersonClass>() .Name("personFilter") .DataSource("peopleDS") .ApplyButton(false) .Fields(f => {

f.Add(p => p.LastName).Label("Last Name");
         f.Add(p => p.FirstName).Label("First Name");
         f.Add(p => p.MiddleName).Label("Middle Name");

f.Add(p => p.StartDate).Label("Start Date").Operators(o => o.Date(d => d.Eq("Is equal to").Gte("Greater than equal").Lte("Less than equal"))); }) )

 I have helper code to handle the toolbar in my Kendo Grid like the following, :

@helper ToolbarTemplate()
{
    <button class="k-button k-button-solid k-button-solid-base" id="applyFilter"><span class="k-icon k-i-filter"></span>Apply Filter</button>
    <button class="k-button k-button-solid k-button-solid-base" id="clearFilter">Reset</button>
    <button class="k-button k-grid-excel k-button-solid k-button-solid-base"><span class="k-icon k-i-excel"></span>Export to Excel</button>
}

I also have some JavaScript in a function to apply the filter when the Apply Filter button is clicked, as seen here:

$("#applyFilter").click(function (e) {
    //e.preventDefault();
    var myFilter = $("#personFilter").getKendoFilter();
    localStorage["kendo-person-filter-options"] = kendo.stringify(myFilter.getOptions().expression);
    myFilter.applyFilter();
});

 

The problem I am having is if I enter an invalid Leap Year date (e.g. 2/29/2003, since 2023 didn't have a February 29th), I get no data back; however, if I enter a valid Leap Year (e.g. 2/29/2004), my Kendo Grid will show data.  Is there a way to validate the date that is being entered manually into a DatePicker field used for filtering?  That is, if I use the DatePicker, it will not show me 2/29/2003 as an option, but if I type in 2/29/2003 and click Apply Filter, it doesn't throw any kind of error about 2/29/2003 being invalid.

0 answers
33 views
I have a ASP.NET MVC Grid


        @(Html.Kendo().Grid<SysViewModel>()
            .Name("grid")
            .Columns(columns =>
            {
                columns.Command(command =>
                {
                    command.Edit()
                    .Text("edit")
                    .UpdateText("update")
                    .CancelText("cancel");
                    command.Destroy().Text("delete");
                }).Width("8rem");

                columns.Bound(p => p.Id)
                    .Title("ID")
                    .Width("5rem");

                columns.Bound(p => p.CompanyId)
                    .Title("Company")
                    .ClientTemplate("#:CompanyName#")
                    .EditorTemplateName("CompanyList")
                    .Filterable(ftb => ftb.Multi(true).CheckAll(true))
                    .Width("15rem");
As you can see the column shows CompanyName, but is bound to CompanyId.

When trying to get filter with checkboxes for company, using:

Filterable(ftb => ftb.Multi(true).CheckAll(true))
I get the checkboxes with CompanyId.

Is there any way to show the CompanyName instead of the CompanyId with the checkbox filter?



Azhar
Top achievements
Rank 1
Iron
 updated question on 20 Nov 2023
1 answer
35 views

Using the following script to build a Filter and DataSource.


When I click the Apply button I would expect the Filter Property in the method to be populated. See screen print below

    <script>
        $(document).ready(function () {
            var dataSource = new kendo.data.DataSource({
                transport: {
                    read: {
                        dataType: "json",
                        url: "/Home/Products_Read"
                    }
                },
                serverFiltering: true,
                pageSize: 4,
                schema: {
                    model: {
                        fields: {
                            ProductName: { type: "string" },

                        }
                    }
                }
            });

            $("#filter").kendoFilter({
                dataSource: dataSource,
                expressionPreview: true,
                applyButton: true,
                fields: [
                    { name: "ProductName", type: "string", label: "ProductName" },
                ],
                expression: {
                    logic: "or",
                    filters: [

                        { field: "ProductName", value: "Chai", operator: "contains" }
                    ]
                }
            });

        });
    </script>

 

 

  
Sean
Top achievements
Rank 1
Iron
Iron
 answered on 16 Sep 2023
1 answer
29 views

Need an example of using the Filter component with a DataSource.  Using the Apply button of the DataSource I would like to pass the arguments collected from the Filter to the Contoller function bound to the Read command of the datasource.

 

 

Sean
Top achievements
Rank 1
Iron
Iron
 answered on 16 Sep 2023
1 answer
74 views
Hi,
I have a project implementing kendo grid UI for asp.net mvc. It has a common .Filterable() as:
.Filterable(ftb =>
{
    ftb.Mode(GridFilterMode.Row);
    ftb.Extra(false);
    ftb.Operators(operators => operators.ForString(str => str.Clear().IsEqualTo("Is equal")
                                                                    .StartsWith("Contains")
                                                                    .IsNotEqualTo("Is not equal"))
                                        .ForDate(str => str.Clear().IsEqualTo("Is equal")
                                                                    .IsNotEqualTo("Is not equal")
                                                                    .IsLessThan("Is less than")
                                                                    .IsGreaterThan("Is greater than")
                                                                    .IsLessThanOrEqualTo("Is less than or equal to")
                                                                    .IsGreaterThanOrEqualTo("Is greater than or equal to"))
                                        .ForNumber(str => str.Clear().IsEqualTo("Is equal")
                                                                    .IsNotEqualTo("Is not equal")
                                                                    .IsLessThan("Is less than")
                                                                    .IsGreaterThan("Is greater than")
                                                                    .IsLessThanOrEqualTo("Is less than or equal to")
                                                                    .IsGreaterThanOrEqualTo("Is greater than or equal to")));
})
However, for 1 particular column, I have set .Filterable(ftb => ftb.Cell(cell => cell.Template("nameOfMyDropDownList")));
The custom filter is populated using JS. The thing is, I want to get rid of the Filter Icon that gets displayed along with the dropdown since it does not make sense to have the filter icon there when we can have a custom filter dropdown. 
I tried adding a class to the element to be hidden. But the class name doesn't get added. 
Anton Mironov
Telerik team
 answered on 11 Sep 2023
0 answers
36 views

I'm experiencing an issue that I've had a couple times utilizing the kendo UI libraries with formatting.

It seems that the formatting commands are not the same throughout the library, and as well there is limited documentation on PreviewFormatting.


 @(Html.Kendo().Filter<OrderSearchBindingModel>()
.Name("filter")
.ApplyButton()
.ExpressionPreview()
.MainLogic(FilterCompositionLogicalOperator.Or).Fields(f =>
  {
      f.Add(p => p.InternalOrderId).Label("Order ID").PreviewFormat("n");
      f.Add(p => p.ExternalOrderId).Label("EX Order ID");
}).FilterExpression(fe =>
  {
      fe.Add(p => p.InternalOrderId);
}).DataSource("source"))

I have tried the following formats with no success I'm simply trying to achieve a raw numerical value no commas, or decimals.

n

n0

#

#############

Is there documentation pointing to this specific formatter and it's options?

Headygains
Top achievements
Rank 1
Veteran
 asked on 07 Sep 2023
1 answer
137 views

hi,

When Multi checkbox column is enabled in MVC Kendo Grid, it keeps spinning and not loading filter checkboxes for large dataset.
Please find the sample code attached.

We use Kendo.Mvc, Version=2022.1.412.0.
This sample code uses lesser version.

@(Html.Kendo().Grid<TelerikMvcApp6.Models.OrderViewModel>()
            .Name("grid")
            .Columns(columns =>
            {
                columns.Bound(p => p.OrderID).Filterable(false);
                columns.Bound(p => p.Freight);
                columns.Bound(p => p.ShipName);
                columns.Bound(p => p.ShipCity).Filterable(f => f.Multi(true).Search(true));
            })
            .Pageable()
            .Sortable()
            .Scrollable()
            .Filterable()
            .HtmlAttributes(new { style = "height:550px;" })
            .DataSource(dataSource => dataSource
                .Ajax()
                .PageSize(10)
                .Read(read => read.Action("Orders_Read", "Grid"))
            )
        )

Regards

Karthik

Ivan Danchev
Telerik team
 answered on 04 Aug 2023
1 answer
166 views

Given a grid, GridFilterMode.Row, with 3 columns (First Name, Surname, Nick Name) with 100 rows.

Given I have filtered the Surname column and now the grid is displaying 10 rows based on the applied filter on the Surname column.

If type one or more letters in the "First Name" field filter it will suggest all corresponding values to the dataSource even the ones that are not being displayed in the grid due to the applied filter in the column Surname.

Is there any way to suggest only values in the "view()" data (only values displayed in the grid)?

I haven't found any additional information on the documentation.
Any help is welcome.

Example:

  • No filters have been applied so far:

  • Applying a filter to the "Freight" column to values bigger than "890.00":

  • Grid has now 2 rows based on the Freight filter. The user has typed on the "Ship Name" filter column and the grid has suggested all possible names that match  with it instead suggest only based on the 2 available rows (QUICK-Stop | Queen Cozinha)

Anton Mironov
Telerik team
 answered on 13 Jul 2023
Narrow your results
Selected tags
Tags
+? more
Top users last month
Dominik
Top achievements
Rank 1
Giuliano
Top achievements
Rank 1
Dominic
Top achievements
Rank 1
Glendys
Top achievements
Rank 1
NoobMaster
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Dominik
Top achievements
Rank 1
Giuliano
Top achievements
Rank 1
Dominic
Top achievements
Rank 1
Glendys
Top achievements
Rank 1
NoobMaster
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?