Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to hide the expand/collapse icon for the detail grid in kendo ui

I am using kendo ui grid detail Template. In the grid i have a dropdown with some values like dropdown, textbox etc. If i add the new record then i don't want to show the expand/collapse icon. After selecting the dropdown and the selected value will be dropdown then only i want to show the expand/collapse icon. How can i able to do this using kendo ui. Hope you understand my quesion. I have tried to access that in the dataBound Event like this

     dataBound: function (e) {         

                var dataSource = this.dataSource;         
                this.element.find('tr.k-master-row').each(function() {

                    this.tbody.find("tr.k-master-row>.k-hierarchy-cell>a").hide();

                });
            }
like image 754
Jonathan Avatar asked Oct 24 '25 18:10

Jonathan


2 Answers

Try this:

function dataBound() {
    var grid = this;

    //expand all detail rows
    grid.tbody.find("tr.k-master-row").each(function () {
        grid.expandRow($(this));
    })

    //remove hierarchy cells and column
    $(".k-hierarchy-cell").remove();
    $(".k-hierarchy-col").remove();
}
like image 182
Murat Yıldız Avatar answered Oct 28 '25 06:10

Murat Yıldız


Another option is to set the Width() to look like it's hidden.

function dataBound() {
    $(".k-hierarchy-cell", "#gridName").width(0.1);
    $(".k-hierarchy-col", "#gridName").width(0.1);
}
like image 42
ShawnOrr Avatar answered Oct 28 '25 05:10

ShawnOrr



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!