This is a migrated thread and some comments may be shown as answers.

Samples

3 Answers 123 Views
AutoComplete
This is a migrated thread and some comments may be shown as answers.
Larry
Top achievements
Rank 1
Larry asked on 07 Feb 2013, 03:34 PM
I am very new to this. I have never used MVC.  Nor have I every used JQuery.  I apologize for my simple question.

As I look through your demos, I see many different and SIMPLE versions of your controls.  There is documentation using JavaScript,. There are ASPX samples.  There are Razor examples.  There are controls that use the HTML helper method. There are examples using the JQuery to convert a DIV into an AutoComplete.  It is very frustrating trying to find a consistent, thorough example using any one of those methods.  Then it is very difficult to find Kendo stuff too. This is why I am having trouble trying to find my answer.    

I want to use VS 2012, MVC 4, JQuery, and Razor with your AutoComplete control to retrieve a dataset based on user input.  The table of information I am hitting has 10,000 rows. Each row is very wide (70 fields or so).  I want to use this AutoComplete to drive the detail record to be shown in the detail view.

CSHTNL Code:
@(Html.Kendo().AutoComplete()
    .Name("policyComboBox") //The name of the combobox is mandatory. It specifies the "id" attribute of the widget.
    .DataTextField("POL_Policy_Number") //Specifies which property of the Product to be used by the combobox as a text.
    .Filter(FilterType.Contains)
    .MinLength(3)
    .DataSource(source =>
    {
        source.Read(read =>
        {
            read.Action("GetPolicyList", "PolicyReview") //Set the Action and Controller name
            .Data("onAdditionalData");
             
        })
        .ServerFiltering(true); //If true the DataSource will not filter the data on the client.
    })
     
)
 
 
<script>
    function onAdditionalData() {
        return {
            text: $("#policyComboBox").val()
        };
    }
 
    function requestData(selector) {
        var combobox = $(selector).data("kendoComboBox"),
            filters = combobox.dataSource.filter(),
            value = combobox.input.val();
 
        if (!filters) {
            value = "";
        }
 
        return { text: value };
    }
 
</script>
and my PloicyReviewController.cs:

public JsonResult GetPolicyList()
        {
            IQueryable<POLICY> POLCY = (from p in ctxt.Policies
                         select p);
           
            return Json(POLCY, JsonRequestBehavior.AllowGet);
 
 
        }
Every time I open the view, I get the controller starting immediately.  It then returns too many rows to deal with and the view stops working or I get the Yellow Page of Death or the dev server eats up my entire RAM.

Please help.  I have been struggling with this and am getting quite discouraged about using your Kendo UI Suite.

Thank you, Larry

3 Answers, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 11 Feb 2013, 12:39 PM
Hello Larry,

Since you are using Server filtering you need to ensure on the server that the records wont be too many. For example you can limit the result to be maximum 1000 records (anyway it is useless to show so many records to the end user).
You can use the Take() extension method LINQ provdes.
e.g.
public JsonResult GetPolicyList()
        {
            IQueryable<POLICY> POLCY = (from p in ctxt.Policies
                         select p);
            
 
            return Json(POLCY.Take(1000), JsonRequestBehavior.AllowGet);
  
  
        }


Kind Regards,
Petur Subev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
TK Interactive
Top achievements
Rank 1
answered on 03 Jun 2016, 06:11 AM

We are using kendo grid filters and have added Kendo autocomplete as templte for filter  coloumn. The data source remains same and we need to restrict the autocomplete results to 10 records. Here is the sameple that we are using:

filterable: {
                    cell: {
                        template: function (args) {
                            args.element.kendoAutoComplete({
                                dataTextField: "title",
                                dataSource: args.dataSource,
                                filter: "contains"
                            });
                        },
                        operator: "contains",
                        showOperators: false
                    }
                }

0
Dimiter Topalov
Telerik team
answered on 06 Jun 2016, 04:15 PM
Hi Thomas,

As this thread was last active more than 3 years ago, please submit a new support thread, providing further details about the scenario, and the desired behavior, as well as your Grid and AutoComplete configurations, and we will be happy to assist, if the desired functionality is supported.

Thank you in advance.

Regards,
Dimiter Topalov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
AutoComplete
Asked by
Larry
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
TK Interactive
Top achievements
Rank 1
Dimiter Topalov
Telerik team
Share this question
or