angularjs - ng-grid afterSelectionChange return value -


it's possible afterselectionchange return value ng-grid ???

how can accomplish it? want $scope.programedit value,

setpagingdata function set data show on view ,

getpageddataasync function value $resource

anyone ideas ?

please

$scope.setpagingdata = function(data, page, pagesize, type){     var array = [];     for(var key in data){       if(!data.hasownproperty(key)){         continue;       }         array.push(key, data[key])     }     if(type == 0){       var = array.slice(1,4);       $scope.mydata = a[0];     }else{       var = array.slice(1);       $scope.mydata = a;     }      $scope.totalserveritems = data.length;     if (!$scope.$$phase) {         $scope.$apply();     }     return $scope.mydata };   $scope.getpageddataasync = function (pagesize, page, searchtext, type) {     settimeout(function () {         var data;           programservice.query({              page: page           }, function (result) {             data = {               'program': result             };             $scope.setpagingdata(data,page,pagesize,0)             return data           });     }, 100);  };  $scope.gridoptions = {     data: 'mydata',     enablepaging: true,     showfooter: true,     totalserveritems:'totalserveritems',     pagingoptions: $scope.pagingoptions,     filteroptions: $scope.filteroptions,     selecteditems: $scope.myselections,     multiselect: false,     afterselectionchange: function ($routeparams, $location, programservice) {       $scope.program = $scope.myselections[0];       var id = $scope.myselections[0].programid;       if ($scope.myselections[0].programid) {         $scope.programedit = {           'program': programservice.get({             page: 1,              id: $scope.myselections[0].programid           })};       }       } }; 

i want show on edit html

<form ng-submit="save()">  <input type="hidden" ng-model="programedit.programid"/>  <dl>    <dt>program name</dt>    <dd><input name="programname" type="text" ng-model="programedit.programname"/></dd>   </dl>   <div class="form-actions">    <button type="submit">save</button>   </div> </form> 

$scope.programedit should contain programid , programname (something $scope.programedit = {programid: 11, programname: 'hello'} setting programservice.get property named program.

what should do, assuming programservice.get promise, , returns json object data should that:

programservice.get({ page: 1, id: $scope.myselections[0].programid }).success(function(data) {   $scope.programedit = {programname: data.programname, programid: data.programid}; }); 

Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -