Telerik Forums
Kendo UI for jQuery Forum
1 answer
199 views

In Kendo Grid it is possible to show/hide buttons in command column conditionally.

How can I achieve that in TreeList?


command: [
	{
		imageClass: "k-i-info",
		name: "details",
		text: "Details",

		visible: function (dataItem) { return dataItem.LastName.charAt(0) !== "D" }

	}
]

Georgi Denchev
Telerik team
 answered on 15 Dec 2021
1 answer
77 views

Hi,

I'm trying to avoid dragging column in treelist to very first position, since it's kind of checkbox column and must be the first all the time. I wanted to handle columnReorder event (which i handle anyway) and cancel it, but this approach simply does not work. 

Something like

if (e.newIndex === 0)
            {e.preventDefault();}

Have you got any tips, what to try next, please?

 

Regards, Jaroslav

Georgi Denchev
Telerik team
 answered on 27 Oct 2021
0 answers
41 views

I have a TreeList and a connected ContextMenu.   The context menu shows correctly the first time only when clicking on a TreeList row.  After that however, no matter where I right-click on the page, the context menu is displayed.


@(Html.Kendo().ContextMenu()
    .Name("orgtreemenu")
    .Target("#OrganizationTreeMaintenance")
    .Orientation(ContextMenuOrientation.Vertical)
    .Filter(".k-grid-content table tbody tr[role='row']")
    .Events(e => e
        .Open("orgContextMenuOpen")
        .Select("orgTreemenuSelect")
    )
    .Items(items =>
    {
        items.Add()
            .Text("Add Organization")
            .HtmlAttributes(new { @id = "addorgaction" })
            .Enabled(true);
        items.Add()
            .Text("Edit Name")
            .HtmlAttributes(new { @id = "editorgnameaction" })
            .Enabled(true);
        items.Add()
            .Text("Delete Organization")
            .HtmlAttributes(new { @id = "deleteorgaction" })
            .Enabled(true);

        items.Add()
            .Text("Move Organization")
            .HtmlAttributes(new { @id = "moveorgaction" })
            .Enabled(false);
    }))
@(Html.Kendo().TreeList<UserStatViewModel>()
    .Name("OrganizationTreeMaintenance")
    .Columns(columns =>
    {
        columns.Add().Field(e => e.OrganizationName).Width(300);
        columns.Add().Field(e => e.OrganizationId).Hidden(true);
        columns.Add().Field(e => e.TotalUserCount).Title("Users");
        columns.Add().Field(e => e.TotalDeviceCount).Title("Devices");
        columns.Add().Field(e => e.LicensedUserCount).Title("Licenses");
    })
    .Sortable()
    .HtmlAttributes(new { style = "height:500px;" })
    .Events(e => e
        .DataBound("onDataBoundLicenseTree"))
    .DataSource(dataSource => dataSource
        .Read(read => read.Action("GetOrgLicenseDetails", "home"))
        .ServerOperation(false)
        .Model(m =>
        {
            m.Id(f => f.OrganizationId);
            m.ParentId(f => f.ParentOrgId).DefaultValue(0);
            //           m.Expanded(true);
            m.Field(f => f.OrganizationName);
            m.Field(f => f.TotalDeviceCount);
            m.Field(f => f.ParentOrgId);
        })
    ))

I have tried modifying the Filter on the context menu to no avail.  Hoping someone can see something obvious.

Thanks and regards,

Eric Katz

Eric
Top achievements
Rank 1
 asked on 23 Sep 2021
0 answers
65 views
Hello I have some nested column headers and locked columns.. The ones on the locked side aren't expanding 100% ondataload.. see screenshot... when I move the column they expand down..

m
Top achievements
Rank 1
Iron
Iron
 asked on 14 Sep 2021
1 answer
159 views
Hello, i have been able to merge some cells on the ondataload call ... but when saving the treelist something triggers the cells to go back to normal... is there an event etc that I can call my merge cells function after saving?


post save

Nikolay
Telerik team
 answered on 16 Aug 2021
1 answer
42 views
Hello i am trying to get the kendoeditor inside of a treelist with incell editing.. this is working here https://dojo.telerik.com/UnEguTAJ , but I'd like the rows on both sides (locked left and right ) to expand to the same height when clicking into to edit one of the fields...
Nikolay
Telerik team
 answered on 14 Jul 2021
0 answers
80 views
Hello, I have written some custom jquery to conditionally combine columns with a colspan attribute which is added ondatabound... everything works however if I click cancel changes or save changes the colspan immediately gets overwritten to 1 1 instead of the 3 that I have written... thoughts? I am using locked columns as well..
m
Top achievements
Rank 1
Iron
Iron
 asked on 08 Jul 2021
1 answer
144 views

Hi there,

I would like to use the MultiSelect to set the value of a cell in a TreeList.

My code almost works, but once the MultiSelect closes the values displayed in the grid are not what I expected.

I tried using a template to display selected values, but it doesn't look right.

Here is a dojo link https://dojo.telerik.com/OdAFErap/11 and below the code of that dojo

 

Thanks in advance,

 

<!DOCTYPE html>
<html>
<head>
    <base href="https://demos.telerik.com/kendo-ui/treelist/local-data-binding">
    <style>html { font-size: 14px; font-family: Arial, Helvetica, sans-serif; }</style>
    <title></title>
    <link rel="stylesheet" href="https://kendo.cdn.telerik.com/2021.2.616/styles/kendo.default-v2.min.css" />

    <script src="https://kendo.cdn.telerik.com/2021.2.616/js/jquery.min.js"></script>
    
    
    <script src="https://kendo.cdn.telerik.com/2021.2.616/js/kendo.all.min.js"></script>
    
    

</head>
<body>
            <div id="example">
            <div id="treelist"></div>
              
            <script type="text/kendo" id="alertsTemplate">
               # if (Alerts) { #
              <ul>
                # for(var i = 0; i< Alerts.length; i++){ #
                <li>#: Alerts[i].name #</li>
                # } #
              </ul>
              # } #
            </script>

              
            <script>
              $(document).ready(function () {
                
                var AlertsList = [
                  { code: '9', name: 'Black' },
                  { code: '5', name: 'Red' },
                  { code: '5', name: 'Yello' },
                  { code: '3', name: 'Blue' },
                  { code: '1', name: 'Green' }
                ];

                var alertsEditor = (container, options) => {
                  $('<input name="Alerts">')
                      .appendTo(container)
                      .kendoMultiSelect({
                        dataValueField: "code",
                        dataTextField: "name",
                        dataSource: AlertsList
                      });
                };
                
                    var dataSource = new kendo.data.TreeListDataSource({
                      data: [
                          { id: 1, Name: "Daryl Sweeney", Alerts: null, parentId: null },
                          { id: 2, Name: "Guy Wooten", Alerts: null, parentId: 1 },
                          { id: 32, Name: "Buffy Weber", Alerts: null, parentId: 2 },
                          { id: 11, Name: "Hyacinth Hood", Alerts: null, parentId: 32 },
                          { id: 60, Name: "Akeem Carr", Alerts: null, parentId: 11 },
                          { id: 78, Name: "Rinah Simon", Alerts: null, parentId: 11 },
                          { id: 42, Name: "Gage Daniels", Alerts: null, parentId: 32 },
                          { id: 43, Name: "Constance Vazquez", Alerts: null, parentId: 32 },
                          { id: 46, Name: "Darrel Solis", Alerts: null, parentId: 43 },
                          { id: 47, Name: "Brian Yang", Alerts: null, parentId: 46 },
                          { id: 50, Name: "Lillian Bradshaw", Alerts: null, parentId: 46 },
                          { id: 51, Name: "Christian Palmer", Alerts: null, parentId: 46 },
                          { id: 55, Name: "Summer Mosley", Alerts: null, parentId: 46 },
                          { id: 56, Name: "Barry Ayers", Alerts: null, parentId: 46 },
                          { id: 59, Name: "Keiko Espinoza", Alerts: null, parentId: 46 },
                          { id: 61, Name: "Candace Pickett", Alerts: null, parentId: 46 }
                        ],
                        schema: {
                            model: {
                                id: "id",
                                expanded: true,
                              	fields: {
                                  	Name:   { type: "string", editable: false },
                                  	Alerts: { type: "string", editable: true }
                                }
                            }
                        }
                    });

                $("#treelist").kendoTreeList({
                        dataSource: dataSource,
                        height: 540,
		                		batch: true,
                        editable: "inline",
                        columns: [
                            "Name",
                            { 
                              field: "Alerts",
                              editor: alertsEditor,
                              template: $("#alertsTemplate").html()
                            },
                            { command: ["edit"] }
                        ]
                    });
                });
            </script>
        </div>


    

</body>
</html>

Martin
Telerik team
 answered on 02 Jul 2021
1 answer
264 views
Can the treelist support this as I am using locked columns but also need to use row-templates and those do not work with locked columns.. I need to be able to scroll some columns horizontally....
Georgi Denchev
Telerik team
 answered on 18 Jun 2021
1 answer
76 views

Hello,

I have treelists with two levels of items (titles and positions). The titles can be rearranged via drag&drop. Dragging a title onto another title changes the order of titles. Positions can both be dragged under the same title but also to an other title.

Examples:

  • Dragging title 4 onto title 2 makes title 4 the new title 2, title 2 becomes title 3 and title 3 becomes title 4. All subitems (positions) stay with their titles.
  • Dragging position 4 in title 3 (3.4) onto position 2 in title 3 (3.2) makes 4 the new 2 (3.2), 2 the new 3 (3.3) and 3 the new 4 (3.4).
  • Dragging position 4 in title 3 (3.4) onto position 2 in title 2 (2.2) makes 4 the new 2 in title 2 (2.2), 2 in title 2 the new 3 in title 2 (2.3) and position 5 in title 3 (3.5) the new position 4 in title 3 (3.4).

To do this (see code in attachment) I manipulate the title field and the parentId of the datasource. This worked fine as long as I dirctly saved items that were added to the list. But now I have to use batch save.

Now when I add a new title to the list and add or rearrange positions to that title or rearrange titles via drag&drop before saving the affectet titles and positions are attached to wrong parent items, sometimes items get duplicated. Doing the same thing after saving works as intended.

I assume the reason for this is that new items have an Id of 0 before saving.

I see that it is possible to rearrange items in treelists via drag & drop in your demos without manipulating these fields manually. But I don't see how can do this and get the same results as in the examples above. Could you please help me figure this out?

Note: in the attached files I have included sampledata as local data. In the project we bind to remote data. Not sure if this affects the beavior

Georgi Denchev
Telerik team
 answered on 18 Jun 2021
Narrow your results
Selected tags
Tags
+? more
Top users last month
Mark
Top achievements
Rank 1
Yurii
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Hon
Top achievements
Rank 1
Iron
Deltaohm
Top achievements
Rank 3
Bronze
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Mark
Top achievements
Rank 1
Yurii
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Hon
Top achievements
Rank 1
Iron
Deltaohm
Top achievements
Rank 3
Bronze
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?