Telerik Forums
UI for ASP.NET MVC Forum
2 answers
416 views
I have a grid that I can select a row on and then click a button on the grid to move that row's data item to a different grid.

This code has been working fine for months, but broke after the last official release.  I upgraded to the most up to date internal release today (2013.2.814), but still no luck.

Basically, anytime I run code like this:

var grid = $("#ItemBook").data("kendoGrid");
console.log(grid.select()); //Errors
I get a strange error in Firebug and no code after the select line executes.  The error looks a bit like this:
TypeError: r is undefined
...table)),t.css(kt?"padding-left":"padding-right",l.virtual?c+1:c),n=e('<tabl
However, searching for the row by the selected class DOES work.  E.g.:
console.log($("#SavedQuoteBook tr.k-state-selected"));  //Gives tr element
console.log(grid.dataItem($("#SavedQuoteBook tr.k-state-selected")));  //Give dataItem

I don't think it should matter, but the grid as well as the script executing the code above are inside a partial view that's loaded into a Menu Widget.

Here's the code for the views:

Menu Widget Declaration:
@(Html.Kendo().Menu()
                .Name("ItemMenu")
                .OpenOnClick(true)
                .CloseOnClick(false)
                .Items(items =>
                {
                    items.Add()
                        .Text("Items")
                        .Content(Html.Partial("ItemBook", Model.Items).ToHtmlString());
                })
                .Events(events =>
                {
                    events.Open("ItemMenuOpen");
                })
            )

Partial View (Grid + Script):
<script type="text/javascript">
    function ConfigureItemBook() {
   
        //Drives multi-selection of grid rows (Overrides native functionality)
        $("#ItemBook").delegate('tbody tr', 'click', function () {
            $(this).toggleClass('k-state-selected');
        });
 
        //Drive single selection by double click
        $("#ItemBook").delegate('tbody tr', 'dblclick', function () {
            $(this).addClass('k-state-selected');
            PopulateItem();
        });
    }
 
    function PopulateItem() {
        var grid = $("#ItemBook").data("kendoGrid");
 
        console.log("Manual Search");
        console.log($("#ItemBook tr.k-state-selected"));  //This works
        console.log("Manual Search + Get DataItem");
        console.log(grid.dataItem($("#ItemBook tr.k-state-selected")));  //This works
        console.log("Kendo Grid Select");
        console.log(grid.select());  //ERROR
        console.log("Kendo Grid Select + GetDataItem");
        console.log(grid.dataItem(grid.select()));  //ERROR
    }
</script>
 
@(Html.Kendo().Grid(Model)
    .Name("ItemBook")
    .TableHtmlAttributes(new { @style = "cursor:pointer;" })
    .Columns(columns =>
    {
        columns.Bound(i => i.DateCreated).Width(90);
        //Other columns omitted for brevity
    })
    .ToolBar(toolbar =>
    {
        toolbar.Custom().Text("Select").Url("#_").HtmlAttributes(new { onclick = "PopulateItem()" });
    })
    .Events(events =>
    {
        events.DataBound("ConfigureItemBook");
    })
    .Pageable()
    .Sortable()
    .Scrollable()
    .Resizable(resize => resize.Columns(true))
    .Reorderable(reorder => reorder.Columns(true))
    .DataSource(dataSource => dataSource
        .Ajax()
        .ServerOperation(false)
        .Model(model =>
        {
            model.Id(i => i.ID);
        })
    )
)


Jark Monster
Top achievements
Rank 1
 answered on 19 Aug 2013
2 answers
148 views
In out MVC app, we are using a Kendo grid to display/inline edit Department information. We also display a tree view of the Department hierarchy (see below). In Chrome when changes are made to the Department information the tree view dynamically changes, in IE10 this does not occur. We noticed through debugging that in IE10 the "GetDepartmentTree' action is only fired on initial load and is never called again, even when the department page is refreshed. In Chrome this action is fired with each change to the Department information. Any ideas on what we can do to make this more cross-browser compliant?

            @(Html.Kendo().TreeView()
                .Name ("DepartmentTree")               
                .HtmlAttributes(new {@class="dept-treeview"})
                .DataTextField("Name")
                .DataSource(ds => ds
                    .Read(read => read
                        .Action("GetDepartmetsTree", "Administration")
                        .Data("GetParameters")
                    )
                )               
                .LoadOnDemand(false)
            )

Dev Team
Top achievements
Rank 1
 answered on 19 Aug 2013
0 answers
86 views
I have a ASP.NET WebAPI endpoint that is receiving the calls for upload and it appears to be working fine in that the file is uploaded and it returns appropriate JSON.  It is however secured using windows authentication which seems to be causing a problem with loading the thumbnails.  What seems to be happening is that the initial call to the upload endpoint returns a 401 which causes the client to resend the request with the authorization cookie.  It seems that in between those two calls the tiles get updated and an img for the thumb is created even though the thumb hasn't been created on the server yet.  This causes the thumb not to load and it won't even try to load again until the browser is refreshed.  

Without security everything seems to go fine unfortunately the windows auth is a requirement of this application.  Is there a way to force the initial request to
include the auth token or is there a way to delay the reloading of the tiles/images until the second call is complete?  Seems to be mostly working great other than this issue.

Thanks,
Uriah
Uriah
Top achievements
Rank 1
 asked on 18 Aug 2013
5 answers
1.1K+ views
Is it possible to filter a column from a drop down list (from a foreign key look up table) - and if so what's the best way to do this?

The only way I can see to do this a present, is using a toolbar template - which isn't ideal but would be ok, but the example isn't for the MVC extensions ( http://demos.kendoui.com/web/grid/toolbar-template.html ), and it seems there should be an easier way in MVC.

Any examples would be helpful.

Thanks
Daniel
Top achievements
Rank 1
 answered on 16 Aug 2013
1 answer
146 views
<div class="k-block">
    <div class="k-header k-shadow"><span class="k-icon k-i-pencil"></span>Employee Colour</div>
    <div class="editor-label">
            @Html.LabelFor(x => x.BackgroundColour)
        </div>
        <div class="editor-field">
            @(Html.Kendo().ColorPicker().Name("BackgroundColour").Palette(ColorPickerPalette.Basic).Value(Model.BackgroundColour))
            @Html.TextBoxFor(x => x.BackgroundColourInput, new { @class = "editor-colour"})
        </div>
        <br />
        <div class="editor-label">
            @Html.LabelFor(x => x.TextColour)
        </div>
    <div class="editor-field">
        @(Html.Kendo().ColorPicker().Name("TextColour").Palette(ColorPickerPalette.Basic).Value(Model.TextColour))
         @Html.TextBoxFor(x => x.TextColourInput, new { @class = "editor-colour"})
    </div>
    <br/>
</div>
I'm using the code above to load a colour picker, the Model.BackgroundColour and Model.TextColour are strings as below:

rgb(0,255,255)

but when the form loads, the initial colour is always black, can someone tell me what I'm doing wrong please, as looking at the documentation it seems this should work. I should also point out that passing a string as below:

#00FFFF

does work.

Thanks.
Dimiter Madjarov
Telerik team
 answered on 16 Aug 2013
3 answers
168 views
Hello,
i am using Vs2012,kendo 2013.1.154 version,
and i want it to do the dropdown cascade example,and it gives me in firebug,that he doesn't know that javascript function put as filter
the error message is : filterProducts is not defined
here is my view
<div class="demo-section">
    <h2>View Order Details</h2>
    <p>
        <label for="categories">Catergories:</label>
        @(Html.Kendo().DropDownList()
              .Name("groups")
              .HtmlAttributes(new { style = "width:300px" })
              .OptionLabel("Select group...")
              .DataTextField("Name")
              .DataValueField("pkTallyGroup")
              .DataSource(source => {
                   source.Read(read => {
                       read.Action("GetCascadeGroups", "Employees");
                   });
              })
        )
    </p>
    <p>
        <label for="subgroups">Products:</label>
        @(Html.Kendo().DropDownList()
              .Name("subgroups")
              .HtmlAttributes(new { style = "width:300px" })
              .OptionLabel("Select subgroup...")
              .DataTextField("Name")
              .DataValueField("pkTallySubGroup")
              .DataSource(source => {
                  source.Read(read =>
                  {
                      read.Action("GetCascadeSubgroups", "Employees")
                          .Data("filterProducts");
                  })
                  .ServerFiltering(true);
              })
              .Enable(false)
              .AutoBind(false)
              .CascadeFrom("groups")
        )
        <script>
            function filterProducts() {
                return {
                    groups: $("#groups").val()
                };
            }
        </script>
    </p>
    
</div>

what should be the problem?or do i need to set something in VS2012 to see the scripts in the same page?
Regards,
Daniel
Vladimir Iliev
Telerik team
 answered on 16 Aug 2013
6 answers
129 views
Hello,
i have another question:
I would like to filter the grid data,based on some filters(textboxes or dropdowns) and when i press a button,the date will be loaded into the kendo grid.But initially i do not want to fill anything.based on filter inputs,i create the criteria and make the selection in where clause of the repository for the given entity.
How can i do that?can you show me an example?
Best Regards,
Daniel
Nikolay Rusev
Telerik team
 answered on 16 Aug 2013
0 answers
148 views
Hi to all Members.I have installed Kendo and i am using a very basic Grid
I have bind it successfully but paging sorting doesn't seems to Work

This is my View
@model IEnumerable<UserManagementApplication.Models.tblUser>
@{
    ViewBag.Title = "GetDataKendo";
}
<h2>GetDataKendo</h2>
   
@(Html.Kendo().Grid(Model)  
    .Name("Grid")
     .Columns(columns =>
      {        
          
          columns.Bound(model => model.FirstName);
          columns.Bound(model => model.LastName);
          columns.Bound(model => model.EmailAddress);
          columns.Bound(model => model.IsActive);
      })
      
    .Pageable()
    .Sortable()
    .Filterable()
    .Scrollable()
    .Groupable()
    .DataSource(dataSource => dataSource
        .Ajax()
        .Read(read => read.Action("GetUserDataKendo", "User")
        )
    )
)

And this is my Controller Method
 public ActionResult GetUserDataKendo([DataSourceRequest]DataSourceRequest request)
        {                   
            
            var displayedEvents = client.GetUserList(1, 100, "", false, "");      
           var result = new DataSourceResult()
            {
                Data = displayedEvents
            };
            return Json(result);
        }


My problem is that Paging Sorting are not working .Please see attached Image that how my image is showing

Jack
Top achievements
Rank 1
 asked on 16 Aug 2013
2 answers
2.3K+ views

I have created a single page application with Kendo Grid.  and users have different roles. I need to Hide and show buttons on  User Role Type.
Chrys
Top achievements
Rank 1
 answered on 15 Aug 2013
3 answers
159 views
Hello,

We are having some problems with the image browser using the Kendo UI build v2013.2.716.

These problems can be replicated using the image browser demo (/razor/web/editor/imagebrowser) found in the Kendo.Mvc.Examples project provided with the Kendo UI install. These issues were also not present in the Q1 2013 release that we were using before.

When you try to upload an image:
The image uploads successfully but an image named "undefined" is added with the ajax spinner for a thumbnail.
Upon refreshing the page the uploaded image will show correctly in the list.

When you try to create a directory or when you try to delete an image/directory:
A request is posted to the create URL for every file in the list.

The posts look like this:
POST /razor/web/ImageBrowser/Create HTTP/1.1
Name=a100.png&Size=73289&EntryType=0&path=

POST /razor/web/ImageBrowser/Create HTTP/1.1
Name=aeroviewr.png&Size=15289&EntryType=0&path=

POST /razor/web/ImageBrowser/Create HTTP/1.1
Name=bg-glossy.png&Size=1128&EntryType=0&path=

Was some change overlooked and not committed into the code samples? Any workarounds for this?

Thank you
Alex Gyoshev
Telerik team
 answered on 15 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?