我想从我的局部视图中添加一个词典作为数据元素
查看
@using xxx.Helpers
@model xxx.xxx.xxx.AcronymsViewModel
@{
var permissions = AuthHelper.GetPermissions;
}
<span class="ui-icon ui-icon-pencil hand record-list-item" title="Edit" data-controller="xxx" data-detailsview="xxx" data-applicationid="0" data-recordid="@record.Id" data-permissions="@permissions()" />
AuthHelper.GetPermissions是一个声明为:Dictionary&lt; string,Boolean&gt;()。
在我的jQuery方法中,我想解析权限数据属性,以便根据页面级别权限限制html。我是否需要将字典作为JSON字符串传递?
$(document).on('click', '.record-list-item', function () {
try {
var controller = $(this).data('controller');
var detailsView = $(this).data('detailsview');
var applicationId = $(this).data('applicationid');
var recordId = $(this).data('recordid');
var permissions = $(this).data('permissions');
//PARSE permissions here. How can I do this?
}
catch (ex) {
common.LoadError('Error Ocrrured, ex);
}
});