Telerik Forums
Kendo UI for jQuery Forum
2 answers
150 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
1 answer
100 views
Hey guys,
I'm new to Kendo UI. This is basically my first post on forum. I'm on trial version now. I have  a few questions about customizing of column charts.

This is the database in MS SQL that I'm mapping.
[url=http://ifotos.pl/zobacz/1png_neepeqr.png/][img]http://s6.ifotos.pl/mini/1png_neepeqr.png[/img][/url]
This is my controller:
public ActionResult Index()
{
IList<CzasPracyMaszyn> CzasPracyMaszyn = _repository.GetCzasPracyMaszyn();
return View(CzasPracyMaszyn);
}
 
My model:
public class CzasPracyMaszyn
{
public virtual int ID { get; set; }
public virtual string STANOWISKO { get; set; }
public virtual int CZASPRACY { get; set; }
}

and my view:
@model IEnumerable<CMMS_Aplixcom_alfa.Models.CzasPracyMaszyn>

@(Html.Kendo().Chart(Model)
      .Name("aa")
        .Title("aaa")
      .Series(series => {
          series.Column(model => model.CZASPRACY).Name("Czas Pracy");
      })
      .CategoryAxis(axis => axis
          .Categories(model => model.STANOWISKO)
 
        )
)
This is the chart I'm getting.
[url=http://ifotos.pl/zobacz/2png_neepeqa.png/][img]http://s6.ifotos.pl/mini/2png_neepeqa.png[/img][/url]

Now I am able to turn of/ turn on Columns using the box on the right. But I would like to do that for each record in the database separately.




Iliana Dyankova
Telerik team
 answered on 12 Aug 2013
15 answers
105 views
Hello,

The loading image don't stop when endless scrolling is used: http://jsbin.com/eqisip/17/edit

I know that  something changed in the behaviour. But how can I get this smooth?
And in some cases my list has 2 items. Then I also see the loading image.

Thanks,
Martin
Petyo
Telerik team
 answered on 12 Aug 2013
1 answer
453 views
Context: MVC 4 in VS 2102 with Update 3.  Kendo Version: 2013.1.319

I'm developing a Query Wizard web-page. The Index method of the "WorkOrder" controller generates the initial page with the search Criteria (partial view) showing standard filter parameters and a Search button. The search button activates JS which then uses the parameters in the Criteria to download a QueryInfo object (using getJSON). This object represents a stored query in our database. The business layer caches this QueryInfo object in the Session cache. Then, the JS loads the Kendo Grid by loading a partial view into an empty div element (using .load()).

Here is the .cshtml for the Grid:
@model AssetPoint.TabWare.Central.Query.QueryInfo

@(Html.Kendo().Grid<System.Data.DataRowView>()
    .Name("QwGrid")
    .HtmlAttributes(new { style = "height:430px;" })
    .Pageable(pager => pager.Messages(messages => messages.Empty("No data")))
    .Sortable()
    .Scrollable()
    .Filterable()
    .Columns(columns =>
    {
        foreach (AssetPoint.TabWare.Central.Query.IQwInquiryColumn column in Model.ColumnsUsed)
        {
            var gridCol = columns.Bound(column.Name)
                .Title(column.LabelText)
                .Width(InquiryColumn.ComputeWidth(column));
            if (InquiryColumn.HasFormat(column))
                gridCol.Format(InquiryColumn.GetFormat(column));
        }
    })
    .Resizable(b => b.Columns(true))
    .DataSource(dataSource => dataSource
        .Ajax()
        .Read(read => read
            // Set the action method which will return the data in JSON format
            .Action("GetResultsData", "WorkOrder", new { area = "QueryWizard" }) 
            // Specify the JavaScript function which will return the parameter data
            .Data("getParameters") 
        )
        .ServerOperation(true)
    )
)
As you can see, from the dataSource, we have a GetResultsData method which returns the resulting DataTable as a Json object. My plan was to the call the 'refresh()' method on the kendoGrid object's dataSource in the load success function.

My first problem was the when I accessed the 'QwGrid' element after the load, it was not a kendoGrid object, so I tried calling the kendoGrid() method on the element. This does transform the <div>  element into a kendoGrid object

Here is pertinent JS which is located in the very last element before the </body> element, in a
<script type="text/javascript"> $(document).ready(function () {}); </script> block :
function fillGrid()
{
    // get grid definition for currently selected query
    $('#QwResults').load('@Url.Action("Grid","WorkOrder", new { area = "QueryWizard" } )', 
     function (response, status, xhr)
     {
        if (status == "error")
        {
              alert("An error occurred while loading the Grid control.");
        }
        else
        {
            alert("A Grid definition was returned.");

            // bind data to grid
            var grid = $('#QwGrid').kendoGrid();
    
            if (grid != undefined)
            {
                grid.dataSource.fetch();
            }
        }
    });

    window.Parameters = {
        WorkOrder: $("#WorkOrder").val(),
        Description: $("#Description").val(),
        Equipment: $("#Equipment").val(),
        InquiryName: queryInfo.InquiryName,
        Query: queryInfo.Name,
        Criteria: {}
    };

    if (queryInfo.AskAtExecution)
    {
        //    Walk down the inputs in the window, grabbing their names
        //    and values to provide as criteria.  
        $('#window input[data-QW-field]').filter(function () {
            var x = $(this);
            window.Parameters.Criteria[x.attr("data-QW-field")] = x.val().toString();
        });
    }
}

function getParameters(data)
{
     return window.Parameters;
}
Console Errors (in Chrome):
1. Uncaught ReferenceError: getParameters is not defined
2. Uncaught TypeError: Cannot call method 'fetch' of undefined WorkOrder:261

Questions:
1. Why is the getParameters method that I am providing not found?

2. Why is the datasource undefined in the kendoGrid object?

3. Is there a better way to do this? Note: Each query has it's own set of columns and the results are delivered in a DataTable.

Thanks,
Russ
Atanas Korchev
Telerik team
 answered on 12 Aug 2013
3 answers
902 views


 

 

 
Hi, 
 Is possible to set selected values of the multiselect which are not part of the current multiselect client values:  currently, bounded data  of the multilist


When working  with datatasource  which is OData Service, not all data is brought to the client.(All the data is found on the server).  But we still need to mark the selected values of the
multilist. Part of them is not on the client currently

Thanks,

 
Atanas Korchev
Telerik team
 answered on 12 Aug 2013
1 answer
78 views
Hi,

Just wondering is it possible to load a webpage into the editor or would I have to have the webpage's html saved somewhere and load it in this way?

Alex Gyoshev
Telerik team
 answered on 12 Aug 2013
1 answer
409 views
Hello.

I have a dialog that is loaded from ajax and shown with jquery ui dialog, the html returned by ajax contains a kendo ui datepicker, this datepicker works the first time, but after closing the dialog and opening it again the datepicker is just a text input with no kendo behaviour.

I'm using the MVC helpers, the HTML returned by ajax is like this:
<form action="@Url.Action("Save", "Calendario")" method="post" data-as-ajax="edit-appointment">
       <input type="hidden" name="ID" value="@Model.ID" />
       <div class="row">
           <label for="FechaInicio">Fecha Inicio</label>
           @Html.Kendo().DatePicker().Name("FechaInicio").Value(Model.FechaInicio)
       </div>
       <div class="row">
           <label for="Asunto">Asunto</label>
           <textarea name="Asunto">@Model.Asunto</textarea>
       </div>
       <div class="row">
           <label for="Observaciones">Observaciones</label>
           <textarea name="Observaciones">@Model.Observaciones</textarea>
       </div>
       <input type="submit" value="Guardar" />
   </form>

How can I fix it so that it always works, and not only the first time?

Thanks.
Sergi
Top achievements
Rank 1
 answered on 12 Aug 2013
5 answers
181 views
Context: http://jsfiddle.net/regisbsb/2kQGs/

Hi,

I'm trying to do something very simple.
It is just a menu inside a tree. 
But kendo tree gets confused on the onSelect event of the tree. It thinks it is a menu item the e.node!
Could you fix that bug please?

Please open the fiddle and firebug on console tab to see a demo.
Alex Gyoshev
Telerik team
 answered on 12 Aug 2013
1 answer
71 views
Hello,

A client reported that the tooltips on the custom tools we have in the ediors no longer work after the new Q2 kendo version. So I checked, everything is setup as it has always been via the tooltip property. And I checked the documentation to see if anything changed. Looks the same. Then I went to your demos and saw that you have a custom toolbar and it has a tooltip but its also not showing (latest Google Chrome). I can see in your demo that even though the tooltip is setup, the elemnt has no title.

http://demos.kendoui.com/web/editor/custom-tools.html

 Is this some bug or am I just doing something wrong?

Alex Gyoshev
Telerik team
 answered on 12 Aug 2013
3 answers
222 views
Hi all,

I'm using the ASP.NET wrapper, but I figured this question is general enough it would be better posted here.

I'd like to create a cascading dropdown structure for a many-to-many data relationship. An example structure similar to my data:
Course model (id CourseID) can have many Students.
Student model (id StudentID) can have many Courses.
A third table (CourseStudent) links the two IDs, meaning that neither model has an ID reference to the other.

Is there any easy way to do this? Using the "CascadeFrom" method during definition works for one-to-many relationships, but not in this case. Do I need to include a computed property on one of my models in order to have the ID?

Thanks,
Jeff
Kiril Nikolov
Telerik team
 answered on 12 Aug 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?