Telerik Forums
UI for ASP.NET MVC Forum
11 answers
1.4K+ views
Hi,
I'm having datasource as follows
MenuID MenuName ParentMenuID
1           Self             null
2           Functional   null
3           Leave          1
4           Leave Application 3
5           Delete Application 4

I have formed kendo menu like,
@model IEnumerable<ESSUserInterface.Models.Menus>
<div>
    @(Html.Kendo().Menu()
              .Name("menu")
        .Items(items =>
            {
                foreach (var item in Model)
                {
                    if (item.ParentMenuID == null)
                    {
                        items.Add()
                            .Text(item.MenuName)
                            .Items(children =>
                            {
                                foreach (var subitem in Model)
                                {
                                    if (subitem.ParentMenuID == item.MenuID)
                                    {
                                        children.Add().Text(subitem.MenuName)
                                            .Items(innerchildren =>
                                            {
                                                foreach (var grandChilditem in Model)
                                                {
                                                    if (grandChilditem.ParentMenuID == subitem.MenuID)
                                                    {
                                                        innerchildren.Add().Text(grandChilditem.MenuName);
                                                    }
                                                }
                                            });
                                    }
                                }
                            });
                    }
                }
            })
            .Direction(MenuDirection.Right)
      )
</div>

But the above will work only with 3 levels, and menu ID 5 is not visible.
How can i solve this? I have tried few for loops, and nthng worked still.
Georgi Krustev
Telerik team
 answered on 03 Jun 2015
1 answer
204 views

Hi there,

 Is there any way to Unselect a tree node?. I have a databound event which fires the below function.

function equipmentCategoryLoaded(){
            
            $(".k-item").click(function(e){
                var equipmentCategoryTree = $("#equipmentCategoryTreeView").data("kendoTreeView");
                var equipmentCategorySelected = equipmentCategoryTree.select();

                if(equipmentCategorySelected && $(e.currentTarget).attr("date-uid") == $(equipmentCategorySelected.context).attr("data-uid")){
                    equipmentCategoryTree.select($());
                }
            });
         }

 Not sure where i am going wrong.

Any help would be appreciated.

 

Many Thanks

 Arrash

Dimiter Madjarov
Telerik team
 answered on 03 Jun 2015
1 answer
189 views

Hi all

  The company I work for has added the bootstrap styling (kendo.bootstrap.css). It has caused a problem with the column menu items in the kendo grids in the app.

The columns that have enough space to display sub menus to the right work ok (when selecting the down arrow from the column header and then the Columns menu item).

However, the rightmost columns (which show the "Columns" sub menu item to the left) appear with a blue background. This causes an inconsistency with the other columns.

The lines I found to cause the issue are:

.k-menu .k-state-border-right {
background-color: #428bca;
color: #ffffff;
}

 

If I comment that out it works ok (no matter where they appear, all sub-menu items have the same background), but I do not know what else this may affect.

Is there a way to fix the bug with the rightmost column menu items?

Thanks in advance

Dimo
Telerik team
 answered on 03 Jun 2015
1 answer
175 views

Hi Team,

 We are making use of the export to pdf feature in kendo grid.

We are using virtual scroll as true and our page size is 100. But we are facing a timeout issue and web page non-responsive issue on pdf export. Our service calls for getting data to grid is really fast, it will come within 2 secs.

 

Why we are facing this issue.? Any resolution. Also I have another question in pdf generation. How kendo is generating the PDF? Is it from server side or client side?

Are we sending the html to server and generating the pdf?

 

Thanks

Kiran B

Alexander Popov
Telerik team
 answered on 02 Jun 2015
3 answers
147 views

I'm loading about 2100 items in the treeview, top tier only, using incremental load for sub tier items.  The tree takes about 20 seconds to load, which will be a pain point to the end user.  I timed the server call to actually retrieve the 2100 items to populate, and that only takes about 1 second.  The rest of the time is spent loading the treeview client side.  Is there any way to make this faster?  I realize that's a lot of items and it might be unreasonable to expect it to load in just a few seconds.

 

thanks

Kiril Nikolov
Telerik team
 answered on 02 Jun 2015
0 answers
105 views

We currently use many telerik UI components but have yet to use the scheduler.  

I was wondering if anyone has used the scheduler/gnatt to do more advanced scheduling, like setting up "production jobs" to run on any given machine in a factory.

   If the machine is "busy", we'd want a view of that and for the user to be able to drag and drop the "production job" to another machine.

 

I apologize as this is somewhat difficult to explain.  Curious if there are others who use this tool in this way.

Mike
Top achievements
Rank 1
 asked on 02 Jun 2015
1 answer
109 views

I have an application that I have been testing mostly in Firefox, but yesterday decided that I should test in IE.

The versions that I have are:
Firefox 38.0.1
Chrome 43.0.2357.81 m (64-bit)
IE 9.0.8112

The TreeView is similar to that in Method 2 of "Binding to a flat table", but with a lot more data, that I pass in as a global variable.

<div id="tree"></div>
<script>
//  This is not in the View, but is passed as a Global variable
var flatData = [
  { id: 1, parent: null, text: "Item 1" },
  { id: 2, parent: null, text: "Item 2" },
  { id: 3, parent: null, text: "Item 3" },
  { id: 4, parent: null, text: "Item 4" },
  { id: 5, parent: 1, text: "Item 1.1" },
  { id: 6, parent: 1, text: "Item 1.2" },
  { id: 7, parent: 1, text: "Item 1.3" },
  { id: 8, parent: 3, text: "Item 3.1" },
  { id: 9, parent: 3, text: "Item 3.2" },
  { id: 10, parent: 5, text: "Item 1.1.1" },
  { id: 11, parent: 5, text: "Item 1.1.2" },
  { id: 12, parent: 5, text: "Item 1.1.3" }
];
//  This is not in the View, but is passed as a Global variable
 
// tree for visualizing data
$("#tree").kendoTreeView({
  dataSource: {
    transport: {
      read: function(options) {
        var id = options.data.id || null;
 
        options.success($.grep(flatData, function(x) {
          return x.parent == id;
        }));
      }
    },
    schema: {
      model: {
        id: "id",
        hasChildren: function(x) {
          var id = x.id;
 
          for (var i = 0; i < flatData.length; i++) {
            if (flatData[i].parent == id) {
              return true;
            }
          }
          return false;
        }
      }
    }
  }
})
</script>

The TreeView looks great in Firefox or Chrome, but in IE, I just get the raw data (flatData) showing as plain text.

Any ideas would be greatly appreciated. The only option that I DO NOT have is upgrading IE.

TIA,
Bob

Dimo
Telerik team
 answered on 02 Jun 2015
5 answers
431 views

Hi,

     When i try to click on edit while there is a row in edit mode already the row gets removed. Please let me know if anybody have an idea?

I have tried with specifying Model.Id but of no use.

 

Note: I am using Kendo grid in ASP.NET MVC helper and this grid is loaded by ajax call in jquery by assigning datasource

Alexander Popov
Telerik team
 answered on 02 Jun 2015
11 answers
1.8K+ views
I have an AutoComplete working in a view.  It's used to look up and employee name.  There is a related field, EmployeeID which I need to populate if the user changes the assigned Employee.  It's natural to look up the name, however, the key field is EmployeeID and that's the value I really need to send back to the database when the View posts.

I'm sending a list of objects (as Json) to the AutoComplete.  There are two properties, Name and ID.  Name is binding correctly to the AutoComplete and is being sent back on Post.  I think I need to use the Select event to get the ID value and populate that field but I can't find the object when I look at the debugging info in the browser when the page is running.  The event variable 'e' doesn't seem to have it.

How can i do this?  Code is appended.

View Code:
<!-- AutoComplete text box for Issue To Employee -->
<div class="row">
     <!-- IssuedToEmployeeName  NOTE: Autocomplete control MUST be the same name
                                      as the field that's being bound or it won't
                                      be sent back in the post operation!!!
      -->
    <span class="col-sm-2">
        <label>Issued To:</label>
    </span>
    <span class="col-sm-2">
       @(Html.Kendo().AutoComplete()
                    .Name("IssuedToEmployeeName")
                    .Delay(100)
                    .MinLength(2)
                    .DataTextField("IssuedToEmployeeName")
                    .Filter("contains")
                    .Events(e =>
                            {
                                e.Change("onChange")
                                 .Select("onSelect")
                                 .DataBound("onDataBound");
                            })
                    .DataSource(source =>
                                    {
                                        source.Read(read =>
                                            {
                                                read.Action("LookUpEmpName", "Home")
                                                    .Data("onAdditionalData");
                                            })
                                        .ServerFiltering(true);
  
                                    })
        )
    </span>
    <span class="col-sm-1">
        @Html.TextBoxFor(model => model.IssuedToEmployeeID, new { @class="form-control" })
    </span>
   <!-- IssuedOnDateTime -->
    <span class="col-sm-2">
        <label>Issue Date/Time:</label>
    </span>
    <span class="col-sm-3">
        @Html.TextBoxFor(model => model.IssuedOnDateTime, new { @readonly = "true" })
    </span>
    <span class="col-sm-2"></span>
</div>

<script>
    function onAdditionalData() {
        return { text: $("#IssuedToEmployeeName").val() };
    }

    function onChange(e) {
        //alert('onChange() event fired');
    }

    function onSelect(e) {
        alert('onSelect() event fired; event arg = ' + e.arguments);
    }

    function onDataBound(e) {
        //alert('onDataBound() fired. event arguement = ' + e); 
    }
</script>


Controller Code:
//
// LookUpEmpName()
public JsonResult LookupEmpName(string text)
{
    string[] empNames = DataAccess.LookupEmpName(text);
    List<NameSearchResult> result = new List<NameSearchResult>();
 
    if (empNames!=null)
    {
        foreach (string name in empNames) {
            NameSearchResult searchResult = new NameSearchResult();
            string empName = null;
            string empID = null;
            CommonMethods.ParseNameSearchResult(name, ref empName, ref empID);
            if((empName!=null) && (empID!=null)) {
                searchResult.IssuedToEmployeeName = empName;
                searchResult.EmployeeID = empID;
            }
            result.Add(searchResult);
        }
    }
    return Json(result, JsonRequestBehavior.AllowGet);
}
      
Georgi Krustev
Telerik team
 answered on 02 Jun 2015
5 answers
158 views

Hi Telerik,

 

the dropdownlist does not select the correct option on initialization when using virtualization (if i turn off virtualization it works fine). Im using it very similar to your demo of virtualization.

Is it possible that this is a bug? Im using version 2015.1.429.545.

 

this is my code:

@(Html.Kendo().DropDownListFor(model => model.person_id)      
        .DataTextField("Name")
        .DataValueField("Id")
        .Filter("contains")
        .OptionLabel("Choose...")
        .Height(300)
        .DataSource(source =>
        {
            source
                .Custom()
                .ServerFiltering(true)
                .ServerPaging(true)
                .PageSize(80)
                .Type("aspnetmvc-ajax")
                .Transport(transport =>
                {
                    transport.Read("ReadForDropDown", "Person");
                })
                .Schema(schema =>
                {
                    schema.Data("Data")
                          .Total("Total");
                });
        })
        .Virtual(v => v.ItemHeight(26).ValueMapper("personsValueMapper"))
    )

Georgi Krustev
Telerik team
 answered on 02 Jun 2015
Narrow your results
Selected tags
Tags
+? more
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?