This is the json to populate the ui-grid
{
"radioList": [
{
"testId": 4,
"remarks": null,
"ordersDto": {
"orderId": 50808,
"visitId": null,
"testMast": {
"testId": 4,
"testName": "X-RAY",
},
"reportses": [
]
}
},
{
"testId": 4,
"remarks": "tested",
"ordersDto": {
"orderId": 50807,
"visitId": null,
"testMast": {
"testId": 4,
"testName": "X-RAY",
},
"reportses": [
{
"report": "very good",
"instCode": null,
"folderNo": null
}
]
}
}
]
}
This is the row template to assign a value in the separate text box.
<div> Reports : <input ng-model="ctrl.report"></input></div>
For each double click on the row corresponding report if present will be displayed in the text box.
rowTemplate: '<div grid="grid" ng-dblclick="grid.appScope.ctrl.setRadioReports(row.entity);" class="ui-grid-draggable-row" draggable="true"></div>'
vm.setRadioReports = function(row){
vm.report = angular.copy(row.ordersDto.reportses[0].report);
row.ordersDto.reportses[0].report = angular.copy(vm.report);// tried copying back but not working.
}
How can I bind the editable textbox updated value(the value that user entered newly) to the grid and to the array, so that I can save the updated report into db.
Here is the plunker http://plnkr.co/edit/WtN312no4POPrJ8Mh07O?p=preview
// Here updated report value will not be present in the grid, how can I get that value in the vm.gridRadioTest.data
$scope.save = function(){
$scope.user.visitMasts[0].radioList = vm.gridRadioTest.data;
}