Telerik Forums
Kendo UI for jQuery Forum
0 answers
71 views
Find Solution by myself
Yun
Top achievements
Rank 1
 asked on 13 Apr 2013
1 answer
78 views
Hi,

In the spirit of the XY Problem, I have an immediate problem I need solving, and also a "How should this be done?" question.

I want to modify the "Basic usage" ListView Demo example [1].  I want to dynamically show or hide the pager based on whether or not there are actually pages to view.  I don't even think the solution I came up with will work in all situations, as it seems the pager doesn't refresh after the ajax success handler gets called.

I put together a JSFiddle that is the modification I want.  It works with jQuery 1.7.2 & 1.8.3 but bombs out with jQuery 1.9.1. My public JSFiddle is currently pointing to jQuery 1.7.2.  Below is the Google Chrome Version 25.0.1364.172 m error I get in jQuery 1.9.1:

Uncaught TypeError: Cannot read property 'msie' of undefined kendo.all.min.js:8(anonymous function)kendo.all.min.js:8(anonymous function)kendo.all.min.js:8Uncaught TypeError: undefined is not a function fiddle.jshell.net:82

In addition, when deploying this same example side-by-side with the latest Telerik WebForms RAD controls, WebResource.axd line 6 also gives a JavaScript error complaining about getBaseTypes().

I am new to Web development, but my understanding is jQuery has continuously slimmed down the core jQuery library and taken away features.  Could it be that Kendo UI Pager is implicitly relying on a jQuery feature that is no longer available?  Since Kendo UI is linked to jQuery 1.9.1, I am looking for a solution from Telerik that doesn't involve upgrading jQuery.

Broadly, dynamically showing/hiding the pager seems like a basic feature that should be there, since the RadGrid supports dynamically showing/hiding the pager.

OS Version: Microsoft Windows 7 Professional
Browser Version: Google Chrome Version 25.0.1364.172 m
jQuery Version: 1.9.1
KendoUI Trial Version: kendoui.aspnetmvc.2013.1.319.trial.zip

[1] http://demos.kendoui.com/web/listview/index.html
[2] http://jsfiddle.net/johnzabroski/jf6cu/4/
Daniel
Telerik team
 answered on 12 Apr 2013
1 answer
53 views
In the URL
http://docs.kendoui.com/getting-started/introduction
under the section "Kendo UI Mobile" there is a code that if you copy and paste it does not work.
"Here is the complete example:"
<script>
var app = new kendo.mobile.Applilcation();
</script>

I changed that code for 
        <script>
             var app = new kendo.mobile.Application(document.body);
        </script>

and it worked.
Petyo
Telerik team
 answered on 12 Apr 2013
2 answers
204 views
Hello:

@(Html.Kendo().Grid<projectInfoViewModel>()
.Name("grid2")
.Columns(cols =>
{
    cols.Bound(e => e.OrgID).Tital("View Detail").Template(e => { }).ClientTemplate(" ");
    cols.Bound(e => e.OrgName).Title("Organization");
})
.DataSource(dataSource => dataSource
.Ajax()
                 .Read(read => read.Action("Index", "Summary"))
    )
     .ClientRowTemplate(
            "<tr>" +
                "<td>" +
                       @Html.ActionLink("#: OrgID#", "Index", "Info", new orgViewModel { oID = int.Parse("#: OrgID#"), uID = int.Parse("#: UserID#") }, null) +
                "</td>" +
                "<td>" +
                    "#: City #<br/>" +
                   "#: ProvinceText#<br/>" +
                    "#: CountryText# " +
                "</td>" +                
             "</tr>"
        )  
 )

I'd like to format the 1st column as Hyperlinks like: <a href="~/Info/Index?oID=999&uID=22">999</a>

however, i am having problem assign value to RouteValue:
new orgViewModel { oID = int.Parse("#: OrgID#"), uID = int.Parse("#: UserID#") }

oID and uID are both int, if I don't have int.parse(), it will complain that 'Cannot implicitly convert type 'string' to 'int'', I've tried Convert.ToInt32(), Int32.Parse(), int.Parse() all give error: Input string was not in a correct format. 

Please advise,
Thank you
HSO
Top achievements
Rank 2
 answered on 12 Apr 2013
2 answers
54 views
Hello:

Here is the Razor view of Grid declaration:

@(Html.Kendo().Grid(Model)
.Name("grid")
.Columns(cols =>
{
    cols.Bound(c => c.OrgID).Template(e => { });
    cols.Bound(c => c.UserID);
    cols.Bound(c => c.IsAssigned);
 
})
.RowTemplate(@<text>
@item.OrgName<br />
@item.City, @item.ProvinceText, @item.CountryText
 
</text>)
 
)
There are 3 columns, the one currently in RowTemplate only applies to the 1st column, I also need the 2nd column to be 'templated', which shows a photo and name of the User (accessable by @item.ImgURL, @item.FullName).
I am not sure how to do that, because if I put <tr> or <td> within RowTemplate @<text> block, it complains that those elements cannot be nested.  if I don't have <tr> or <td>, the html output puts colspan="3", so no way for me to come up 3 column structure.

Please advise,

Thank you,
HSO
Top achievements
Rank 2
 answered on 12 Apr 2013
1 answer
1.4K+ views
Hi,

I'm using the MVC wrappers with ajax binding and I cannot find a way to maintain row selection after an automatic timer initiated grid refresh. The timer is working just fine, but the row selection is lost after the refresh. I think it would be very good to get an example from Telerik as I've spent quite a bit of time searching the internet and this must surely be a common requirement.

Can someone please help with the following code?:

var timer = $.timer(function () {
        
    // -- find currently selected row --
    var grid = $("#Grid").data("kendoGrid");
    var row = grid.select();
    var uid = row.data("uid");
        
    // -- refresh grid --
    grid.dataSource.read();
        
    // -- reselect row --
    var row2 = grid.table.find('tr[data-uid="' + uid + '"]');
    row2.addClass('k-state-selected');
    
});
timer.set({ time: 5000, autostart: true });

Thanks in advance
Dimiter Madjarov
Telerik team
 answered on 12 Apr 2013
1 answer
81 views
With the hierarchical grid setup. Can I disable or prevent the child grid on a row by row basis? Or do I need to use brute force and remove the expand/collapse class on the column?
Dimiter Madjarov
Telerik team
 answered on 12 Apr 2013
1 answer
195 views
I have this grid, It's created through viewmodel that returns two objects, one of them is in a list form and create  columns dynamically. I don't have trouble setting values, I can do this perfectly using javascrip. But, when I click to save returns the controller only null values in the list, could set values in a list like this?
Thanks

Grid:
@(Html.Kendo().Grid(Model)
    .Name("Programas")
    .Columns(columns =>
    {
        columns.Bound(t => t.Programa.ProgramaId).Title("Programa");
   
        for (var i = 0; i < ViewBag.num; i++)
        {
            columns.Bound(e => e.Empresas[i].Selected).ClientTemplate("#=funcao(Empresas[" + i + "])#");
               
                
        }
    })
    .Filterable()
    .ToolBar(tb => tb.Save()
    .Editable(ed => ed.Mode(GridEditMode.InCell))
    .DataSource(data => data
        .Ajax()
            .Model(mod => {
                mod.Id(m => m.Programa.ProgramaId);
                  
            })
        .Batch(true)
        .Read(read =>read.Action("GetProgramas","ProgramaRede", new { id = ViewBag.RedeId}))
        .Update(up =>up.Action("UpdateProgramas","ProgramaRede", new { id = ViewBag.RedeId })
        )))
JS:
function set(line, checkbox) {
   
    var state = $(line).is(':checked');
    var grid = $('#Programas').data().kendoGrid;
    var dataSource = grid.dataSource.view()[line.id]
       
   
    for (var c = 0; c < dataSource.Empresas.length; c++)
        if (dataSource.Empresas[c].Value == checkbox) {
               
            dataSource.Empresas[c].set("Selected", state)
               
            dataSource.dirty = true;
   
        }
}
   
function funcao(emp, prog) {
       
    retorno = "<input type='checkbox' onclick='set(this,\"" + emp.Value + "\")'  class='chkbx' id=" + prog + " " + ((emp.Selected) ? "checked = 'checked'" : '') + " class='chkbx' />";
       
    return retorno;
}
Update Controller:
        [AcceptVerbs(HttpVerbs.Post)]
        public ActionResult UpdateProgramas(short id, [DataSourceRequest] DataSourceRequest request, [Bind(Prefix = "models")]  IEnumerable<ProgramaRedeViewModel> model)
        {
///////function to editing
}
Petur Subev
Telerik team
 answered on 12 Apr 2013
2 answers
178 views
Is it possible to bind a complex object to both the master grid and the subgrid using the html helper?  For example, if I have a collection of Employers, and each Employer contains a collection of Employees, and these collections share a EmployeeId.  Is it possible to bind the Employer to the master grid, and have the subgrid bound to Employees?  I need this to all be bound simultaneously so that the main and subgrids can both be displayed when the page loads.  Thanks.
Wayne
Top achievements
Rank 1
 answered on 12 Apr 2013
0 answers
34 views
Hi
I successfully bind from chrome but not from explorer 9.
do you know about this ?
I can see in fiddler that the json url is not called, why ?
Thanks


var items = new kendo.data.DataSource({
schema: {data: "GetProdByBizResult.RootResults"},
type: "json",
serverFiltering: true,
transport: {
read: {
url:"http://www.yelotag.com/light/BizRef-Web-DomainService1.svc/JSON/GetProdByBiz",
datatype:"json",
data: {bizId: window.bizId,
lg: window.lg
}
}
}
});
Michal Revivo
Top achievements
Rank 1
 asked on 12 Apr 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?