Telerik Forums
Kendo UI for jQuery Forum
3 answers
167 views
I am using the file:http://demos.kendoui.com/web/grid/toolbar-template.html example as a starter for my page.
When the page loads I would like to set the filter drop down list and have that set the grid data right from the initial display of the page.

I can then call the page with http://demos.kendoui.com/web/grid/toolbar-template.html?Filter=Beverages
I would like to see "Beverages" in the grid toolbar and the grid would be filtered fshow Beverages only.

It seems a pretty common thing to do.
There are other threads about setting kendo drop downs but, that they are not inside a grid toolbar ...

Abrian
Top achievements
Rank 2
 answered on 12 Aug 2013
1 answer
810 views
How to stop popup a custom window?I use " e.preventDefault();" on edit event but it does not work,the edit window still popup.
Like this  sample,   I click the "Edit" button,  and popup the edit window.But sometimes I click the "Edit" button, but do not want to popup the custom window,I  want to alert("Can not edit"). I just want to popup the edit window when the Product Name is  "Chang" or  hide the "Edit" button when ProductName is not "Chang"
Alexander Valchev
Telerik team
 answered on 12 Aug 2013
4 answers
583 views
Hi,
I am using kendo charts in my application and through the button I am launching a popup to print the chart. Sometimes, the size of the chart is bigger than the content area of the pop up and it shows scrollbars, and beacause of the scrollbars I am not able to print the entire contents of the chart.

 Please let me know how I can resize the chart before printing it.

Thank you,

Poonam
Iliana Dyankova
Telerik team
 answered on 12 Aug 2013
1 answer
159 views
I'm trying to follow the example for populating the grid with remote data.  I've setup my controller to accept the DataSourceRequest param and, per the example, am getting the data from the DB and then calling ToDataSourceResult - which I assume will do the skip/take/count.

A little more detail:
I'm making a call to the DB using EF and calling an SP (not with "using db context" around call so the connection stays open after I return to the controller so the controller can do the skip/take/count).  Once the DB call is complete, I have ObjectResult<MyEntity_Result>.  I then select from this ObjectResult<> into an anonymous type and then call ToDataSourceResult.  The error I get is: "The result of a query cannot be enumerated more than once."

Now, if I call ToList() after I have selected my anonymous type from the ObjectResult<>, but before I call ToDataSourceResult, everything works well.  But, why would I want to call ToList(), especially if I have tons of data?

Second issue: Once I put ToList() on there and am getting data back, the grid isn't showing the data.  When I return the data without the ToDataSourceResult, and do my own skip/take I get data (but of course, I can't get count in addition to the skip/take since it will enumerate twice and throw an exception).  And if I do my own skip/take, the paging doesn't show more than one page when I know there are at least 10,000 records.

Here is the AJAX Controller Action method:

public JsonResult LoadAllUsers([DataSourceRequest]DataSourceRequest request)
{
    var repo = new AdminRepository();
    var users = repo.LoadAllUsers();
    var resp = users.Select(u => new
        {
            u.UserId,
            u.UserName,
            u.FirstName,
            u.LastName,
            u.EmailAddress,
            u.LastActivityDate,
        });
    var data = resp.ToList().ToDataSourceResult(request);
    // var data = resp.Skip(20).Take(20).ToList();
    return Json(data, JsonRequestBehavior.AllowGet);
}

Here is the js that is output:

$('#grid').kendoGrid({dataSource: {transport: {read: '/AdminJson/LoadAllUsers'},schema: {model: {fields: {UserId: { type: 'number' },UserName: { type: 'string' },FirstName: { type: 'string' },LastName: { type: 'string' },EmailAddress: { type: 'string' },LastActivityDate: { type: 'date' }}}},pageSize: 20,serverPaging: true,serverFiltering: false,serverSorting: true,scrollable: true},height: 430,pageable: true,filterable: false,sortable: true,columns: [{ field: 'UserId', title: 'User ID', sortable: false, filterable: false, groupable: false },{ field: 'UserName', title: 'User Name', sortable: true, filterable: false, groupable: false },{ field: 'FirstName', title: 'First Name', sortable: true, filterable: false, groupable: false },{ field: 'LastName', title: 'Last Name', sortable: true, filterable: false, groupable: false },{ field: 'EmailAddress', title: 'Email Address', sortable: true, filterable: false, groupable: false },{ field: 'LastActivityDate', title: 'Last Activity Date', sortable: true, filterable: false, groupable: false, format: '{0: yyyy-MM-dd HH:mm:ss}' }]});
Atanas Korchev
Telerik team
 answered on 12 Aug 2013
1 answer
79 views
Good morning.

I have a trouble using Kendo to make indexed list with local data for over a week.
The Kendo Music Store shows it, but it is for the remote data source. What I want is using local data.
I managed to make one, but it doesn't work. Only after resizing once, it works.
I tried to find a solution and stayed up all night over a week, but did not find it.
So, I put a point on the library files (kendo.min.js, etc).. as the one used in Kendo Music Store is not a recent one.
So I tried to use the older versions of kendo js files, but I can't find them neither.

I hope the master kendo programmers help me with this, and especially with the indexed list with local data problem.
Thank you.
Alexander Valchev
Telerik team
 answered on 12 Aug 2013
1 answer
117 views
Good morning.

I have a trouble using Kendo to make indexed list with local data for over a week.
The Kendo Music Store shows it, but it is for the remote data source. What I want is using local data.
I managed to make one, but it doesn't work. Only after resizing once, it works.
I tried to find a solution and stayed up all night over a week, but did not find it.
So, I put a point on the library files (kendo.min.js, etc).. as the one used in Kendo Music Store is not a recent one.
So I tried to use the older versions of kendo js files, but I can't find them neither.

I hope the master kendo programmers help me with this, and especially with the indexed list with local data problem.
Thank you.
Alexander Valchev
Telerik team
 answered on 12 Aug 2013
1 answer
120 views
Is kendo UI compatible with jquery mobile?
I want to use a date widget(mobile friendly, I know we have one in kendo as well), but it uses jquery mobile 1.3.2
I see a weired behavior, right after the login, i get redirected to the IIS7 welcome.png image.  So basically i cannot access my website.

Thanks
Kiril Nikolov
Telerik team
 answered on 12 Aug 2013
1 answer
227 views
When there are multiple category axes and negative values are present on a column chart, the axis labels collapse down to one line rather than being stacked as normal.  For example:

element.kendoChart({
seriesDefaults: {
type: "column"
},
series: [{
name: "Sales",
data: [10, 20, -0.5, 0, 100, 0],
}],
valueAxis: [{
majorGridLines: { visible: false },
title: { text: "Sales" },
}],
categoryAxis: [{
categories: ["Order", "Invoice", "Credit Memo", "Order", "Invoice", "Credit Memo"],
majorGridLines: { visible: false },
}, {
categories: ["Item", "Resources"],
line: { visible: false },
majorGridLines: { visible: false },
title: { text: "Type & Document Type" },
}],
});

Note that the 2 category axes labels simply collapse on top of one another with the words "Item" and "Invoice" on top of one another and the words "Resources" and "Invoice" on top of one another.  If I change the 3rd value in the series data from -0.5 to just 0.5, then the problem goes away and the 2 category axes are displayed correctly, one above the other.

This behavior seems like a bug since the axes are displayed correctly when the chart contains just positive values, but not if a negative value is present.  Is there some setting I'm missing?

Regards,
Hughes
Iliana Dyankova
Telerik team
 answered on 12 Aug 2013
1 answer
118 views
Does the DS have any way for me to capture and handle jsonp errors?

Is there a best practice?

I've tried this, but nothing happens (no alerts)

dataSource: new kendo.data.DataSource({
                    serverFiltering: true,
                    transport: {
                        read: {
                            url: function (e) {
                                var value = $("#activityTypeBox").data("kendoDropDownList").value();
 
                                if (value != "") {
                                    return "http://site/api/activities/getByType/id/" + value + "/format/jsonp"
                                }
                            },
                            dataType: "jsonp",
                            jsonpCallback: 'myCallback'
                        },
                        parameterMap: function (data, type) {
 
                        }
                    },
                    schema: {
                        errors: "error" // ex: twitter's response is { "error": "Invalid query" }
                    },
                    error: function (e) {
                        alert("Problem populating the curriculum db activities based on that type");
                    }
                })

Atanas Korchev
Telerik team
 answered on 12 Aug 2013
2 answers
154 views
Hi,

I'm trying to bind the grid with a call from WebApi controller based on the project described in this blog post http://www.kendoui.com/blogs/teamblog/posts/12-11-29/the_facts_on_using_kendo_ui_with_asp_net_webapi.aspx . It's actually hitting the method in ApiContoller but the dataRequest is coming as null from and it's never hitting the ModelBinder code.

Code snippets from cshtml and controller are below:
cshtml:
  @(Html.Kendo().Grid<ABC>()
                          .Name("grdEngagements" + Model.UniqueId)
                          .HtmlAttributes(new { Class = "telerikGrid" })
                          .AutoBind(Model.GridAutoBind)
                          .Columns(columns =>
                              {
                                  columns.Bound(p => p.Prop1).HeaderTemplate("Header").Width(80);
                                  columns.Bound(p => p.Prop2).Width(280);
                                  columns.Bound(p => p.Prop3);
                              })
                          .Pageable(p => p.Messages(m => m.Display("{0} to {1} of {2}")))
                          .Sortable()
                          .Scrollable()
                          .Events(e => e.DataBound("gridNoDataMsgDisplay"))
                          .DataSource(dataSource => dataSource
                                                        .Ajax()
                                                        .Model(model => model.Id(p => p.EntityId))
                                                        .Sort(s => s.Add(t => t.Prop3).Descending())
                                                        .Read(read => read
                                                                          .Action("ApiControllerAction", "ApiController")
                                                                          .Type(HttpVerbs.Get).Data("grdEngagementsAjaxReadAdditionalFilterData" + Model.UniqueId))
                          ))

Controller

 //see telerik sample app Grid CustomAjaxBinding for details on how this works
        public JsonResult ApiControllerAction([ModelBinder(typeof(ModelBinders.DataSourceRequestModelBinder))] DataSourceRequest dataSourceRequest, string searchText, bool includeAll)
        {
            var request = dataSourceRequest.ToDataRequest();  // blows up at this point because dataSourceRequest is null
            var sortText = GetSortString(request.Sorts);
            return service.GetABC(request, searchText, sortText, includeAll)
                .ToKendoJsonResult<ABCServer, ABC>();
        }
Manoj
Top achievements
Rank 1
 answered on 12 Aug 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?