我在剑道网格中获取记录,一旦我为网格渲染数据,我想根据ng-click(详细信息)上的记录ID显示模态数据。如何填充模态中每条记录的数据。 到目前为止,我已经尝试过这个..
HTML
<div kendo-window="lrrDetailWin" options="lrrDetailWinOptions" class="lrrDetailWin"></div>
<button class='k-button k-button-icontext' ng-click='showDetail(123)'>Detail</button>
ctrl.js
$scope.lrrDetailWinOptions = lrrSearchGridConfig.modalLrrConfig;
$scope.showDetail = function (dataitem,id,row){
$scope.lawreg = row;
lrrSearchGridConfig.modalLrrConfig.title = 'Law/Rule/regulationDetails';
$scope.lrrDetailWin.setOptions(lrrSearchGridConfig.modalLrrConfig);
$scope.lrrDetailWin.open().center();
}
modalctrl.js
var result = {
ruleId: 23423,
subpartId: 12312
}
$scope.ruleId = result.ruleId;
$scope.subpartId = result.subpartId
lrrDetails.findlrrDetail();
$scope.showDetail = function(id){
lrrDetails.get ($scope.lawreg);
}
Service.js
findlrrDetail: function(){
return $http.get('/url');
},
};
GridConfig.js
angular.module('App').value('lrrSearchGridConfig', {
lrrSearchGrid: {
sortable: true,
pageable: {
previousNext: false,
pageSizes: false
},
scrollable: true,
filterable: true,
columns: [
{
field: 'regionName',
title: 'Jurisdiction',
width: '32px'
}, {
field: 'regInvetoryName',
title: 'Inventory',
width: '32px'
},{
field: 'ruleIdentifier',
title: 'Rule Id',
width: '25px'
}, {
field: 'citationValue',
title: 'Rule Citation',
width: '30px'
}, {
field: 'ruleName',
title: 'Rule Standard Name',
width: '30px'
}, {
field: 'subPartId',
title: 'Subpart Id',
width: '30px'
}, {
field: 'subpartCitation',
title: 'Subpart Citation',
width: '40px'
}, {
field: 'subpartRuleName',
title: 'Subpart Standard Name',
width: '40px'
},
{
command: [
{
text: 'Details',
template: '<button class=\'k-button k-button-icontext\' ng-click=\'showDetail(this.dataItem)\'>Detail</button>'
},
],
title: 'Action',
width: '40px'
}
]
},
modalLrrConfig : {
width : '800px',
title : 'Law/Rule/regulation Details',
modal : true,
content : '/third-party-management/views/subCategories/lrrSearchDetailModal.html',
visible : false
},
JSON.js
{"id":1,
"sourceFeedKey":15,
"lookupCode":"RS_DELETED",
"externalIndintifier":"47",
"subpartCitationIndicator":"1",
"ruleIdentifier":"13",
"ruleSubpartExternalIdentifier":"55029",
"subpartCount":null,
"subpartCitationCount":null,
"citationValue":"18 U.S.C. 2711",
"ruleName":"Definitions For Chapter",
"highValueSummary":"This chapter provides guidance on stored wire and electronic communications and transactional
records access and contains provisions of the Stored Communications
Act.","
issuingAuthKey":873,
"citationAsOfDate":1325566800000,
"vedourActivityType":"Internal Activity",
"vedourActivityDescription1":null,
"vedourActivityDescription2":null,
"applicabilityIndicator":"0",
"auditGroupCategory":null,
"auditGroupIndicator":null,
"citationCoreIndicator":null,
"createdDate":1352497145890,
"modifiedDate":1375313477250,
"createdBy":"ERDSYSTEM",
"mofifiedBy":"NBKQNXS",
"regulatoryInventoryName":{
"id":2,
"inventoryName":"Electronic Communication",
"erhKey":null,
"regInvetoryclassKey":null,
"ntrntlFlag":true},
"regulatoryInventoryClassfication":{
"id":1,
"classificationName":"Compliance",
"sponserWrokerKey":6411},
"geographicLocations":[
{"id":21598,
"sourceFeedKey":5,
"lookupCode":"RS_ACTIVE",
"externalIndintifier":"1",
"geoLocationTransactionKey":0,
"geoLocationCode":"USA",
"geoLocationName":"United States",
"geoLocationShortName":" ",
"regionIdentifier":1,
"regionName":"United States"}],
"enterpriseReportingHierarchies":[
{"id":161,
"erhTransactionKey":161,
"erhName":"Enterprise Privacy Compliance",
"erhShortName":"LCRR",
"erhLevelNumber":4,
"parentId":3320,
"level0Id":0,
"level0Name":"BAC Enterprise Wide",
"level1Id":804,
"level1Name":"Legal Compliance and Regulatory Relations",
"level2Id":167,
"level2Name":"Global Compliance",
"level3Id":3320,
"level3Name":"Enterprise Compliance",
"level4Id":175,
"level4Name":"Enterprise Privacy Compliance","activeIndicator":"1"}]}
答案 0 :(得分:1)
我想这就是你需要的:
答案 1 :(得分:0)
目前还不清楚你到底想要做什么以及你到底尝试了什么。您的网格配置在哪里?你有一个可运行的样本吗?
答案 2 :(得分:0)
首先,在您看来,您有:
<button class='k-button k-button-icontext' ng-click='showDetail(123)'>Detail</button>
因此,您将硬编码的123
传递给showDetail
函数。但是你的函数有三个参数:
$scope.showDetail = function (dataitem,id,row){
所以你应该只接受id
参数。即,删除其他2
$scope.showDetail = function (id){
$scope.selectedId = id;
现在,在您的modalctrl.js
中,您应该可以访问$scope.selectedId
,因此,您可以通过REST呼叫访问您的服务。