2016-11-07 19 views
0

使用以下字段創建了一個UI網格。在ui-grid中添加重複行,在所有其他行上反映的一個字段上鍵入,

vm.gridRadioTest.columnDefs = [{ 
     name: 'testName', 
     displayName: 'Test Name', 
     enableCellEdit: false, 
     enableColumnMenu: false, 
     enableSorting: true, 
     sort: { 
     direction: uiGridConstants.ASC 
     } 
     }, { 
     name: 'remarks', 
     displayName: 'Remarks to Lab', 
     enableCellEdit: true, 
     enableColumnMenu: false 
     }, { 
     name: 'xrayNo', 
     displayName: 'X-ray No', 
     enableCellEdit: true, 
     enableColumnMenu: false 
     }, { 
     name: 'testStatus.status', 
     displayName: 'Status', 
     enableCellEdit: false, 
     enableColumnMenu: false, 
     //cellTemplate: '<a style="cursor: pointer;color: black" class="ui-grid-cell-contents" ng-if="row.entity.resultStatus != null" ng-click="grid.appScope.navigateToPage(row)"><span class=\"glyphicon glyphicon glyphicon-folder-open\" >Report</span></a>' 
     }, { 
     name: 'reportStatus', 
     displayName: 'Report Status', 
     enableCellEdit: false, 
     enableColumnMenu: false, 
     //cellTemplate: '<a style="cursor: pointer;color: black" class="ui-grid-cell-contents" ng-if="row.entity.resultStatus != null" ng-click="grid.appScope.navigateToPage(row)"><span class=\"glyphicon glyphicon glyphicon-folder-open\" >Report</span></a>' 
     },{ 
     name: 'xrayReferral', 
     displayName: 'X-Ray Referral', 
     nableCellEdit : true, 
     editableCellTemplate: 'ui-grid/dropdownEditor', 
     cellFilter: 'mapLabSpecimen:this', 
     editDropdownIdLabel: 'estCode', 
     editDropdownValueLabel: 'estName', 
     editDropdownOptionsArray: vm.instituteList, 
     width: '30%' 
    // enableColumnMenu: false, 
     // cellEditableCondition:false 
     //cellTemplate: '<div class="ui-grid-cell-contents" ng-if="row.entity.resultStatus == \'\'" ><span class=\"glyphicon glyphicon-ok-circle\" style=\"color: green\";>Normal</span></div><div class="ui-grid-cell-contents" ng-if="row.entity.resultStatus == \'Abnormal\' "><span class=\"glyphicon glyphicon-remove-circle\" style=\"color: Red\";>Abnormal</span></div>' 
     },{ 
     name: 'add', 
     displayName: '', 
     enableCellEdit: false, 
     enableColumnMenu: false, 
     width: '3%', 
     cellTemplate: '<div class="ui-grid-cell-contents" ><span class=\"glyphicon glyphicon-plus btn-primary-joli\" ng-click="grid.appScope.reOrderRadioTest()"></span></div>' 
     }]; 

網格推新紀錄每添加按鈕,點擊

$scope.reOrderRadioTest = function(){ 
     vm.gridRadioTest.data.push(radioTestList); 
    } 

radioTestList是

{"code":null,"message":"Total 1 records found","result":{"testId":4,"testName":"X-RAY","testNameAr":null,"testType":"R","componentTestsYn":null,"testUnitMast":{"id":1089,"ucumCode":"pmol/umol","ucumDesc":"PicoMolesPerMicroMole [Substance Ratio Or Substance Fraction Units]","ucumSynonym":"pmol/umol","mohName":"pmol/umol","activeYn":null},"labTestResultRange":{"testid":4,"description":"DESCRIPTION ","sex":"M","fromAge":0,"fromAgeFactor":"D","toAge":15,"toAgeFactor":"D","low":30,"high":50,"intermediateValue":40,"criticalLow":10,"criticalHigh":80,"printDescription":null,"ruleId":null,"createdBy":null,"createdDt":null,"lastModifiedBy":null,"lastModifiedDt":null,"rangeId":2,"activeYn":"Y","alertLowRange":null,"alertHighRange":null},"refOutYn":null,"doneHereYn":null,"mohTestId":null,"activeYn":"Y"}} 

這裏所有的輸入值一個網格場中的所有其他領域出現。 這裏我在一個字段中鍵入ff,它反映在所有其他行中。

enter image description here

我可以用hashkey在內部看,我怎麼能修改

+0

什麼是radioTestList – Bhavjot

+0

感謝的是,您將能夠添加plunker這一點。 – Bhavjot

+0

我認爲這個問題需要更簡潔 – Jigar7521

回答

1

我已經找到了它的解決方案:

在函數中添加一行,加radioTestList變量的初始化。

$scope.reOrderRadioTest = function(){ 
    var radioTestList= {"remarks":'',"testName":''}; 
    vm.gridRadioTest.data.push(radioTestList); 
} 

工作Plunker是在這裏:http://plnkr.co/edit/Vnn4K5DcCdiercc22Vry?p=preview

相關問題