This is a migrated thread and some comments may be shown as answers.

Hierarchical Kendo UI Grid show/hide base on user security

1 Answer 66 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Alexandre
Top achievements
Rank 1
Alexandre asked on 22 Oct 2014, 12:41 PM
Hi,

I manage to implement an hierarchical Kendo UI Grid successfully. However the specifications for the application that I'm building requires that the child grid be only displayed if the current user have the authorization.  How can I achieve this?

1 Answer, 1 is accepted

Sort by
0
Accepted
Alexander Popov
Telerik team
answered on 24 Oct 2014, 07:53 AM
Hello Alexandre,

This could be achieved in a few ways:
  • Use a condition in the Grid initialization options and pass either a valid template ID or an empty string. For example: 
    .ClientDetailTemplateId( isAuthorized ? "myTemplate" : "" )
  • Subscribe to the Grid's dataBound event. Once the event is triggered check whether the user is authorized and if it not - hide all the expand/collapse arrows
  • Subscribe to the detailExpand event and replace the template output with a notification. For example: 
    function onDetailExpand(e) {
      if(!user.isAuthorized){
        e.detailRow.find("td:last").text("You are not authorized");
      }
    }


Regards,
Alexander Popov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Grid
Asked by
Alexandre
Top achievements
Rank 1
Answers by
Alexander Popov
Telerik team
Share this question
or