aftab
aftab

Reputation: 545

How to get related data for each record based on id and populate in the window?

i am getting records in kendo grid once i rendered the data for grid i want to display modal data based on record id on ng-click (detail).how can i populate the data for each record in modal. so far i have tried this..

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"}]}

Upvotes: 0

Views: 617

Answers (3)

Shamoon
Shamoon

Reputation: 43589

First, in your view, you have:

<button class='k-button k-button-icontext' ng-click='showDetail(123)'>Detail</button>

So you are passing the hardcoded 123 to the showDetail function. But your function takes three parameters:

 $scope.showDetail = function (dataitem,id,row){

So you should only accept the id parameter. Namely, remove the other 2

 $scope.showDetail = function (id){
   $scope.selectedId = id;

Now in your modalctrl.js, you should have access to $scope.selectedId, so with that, you can access your service via the REST call.

Upvotes: 0

knikolov
knikolov

Reputation: 1800

I suppose this is what you need:

http://dojo.telerik.com/adiSo

Upvotes: 1

knikolov
knikolov

Reputation: 1800

It is not really clear what exactly you are trying to do and what you have tried so far. Where is your Grid configuration? Do you have a runnable sample?

Upvotes: 0

Related Questions