2013-11-22 1 views
1

내가 거기에 각 JS에서 wijgrid 구성 요소를 사용하고 wijgrid 콜 럼 작동하지 않습니다각도 JS 클릭 이벤트는 HTML 코드를 발견, 내가 구성 요소가 컴파일되지 않습니다 it.in wijgrid HTML에 클릭 이벤트를 수행 할 수없는 문제를 가지고

<wij-grid id = "dataGrid" allow-sorting="true" data="data" columns-autogeneration-mode="none" allow-paging="true" > 
    <columns> 
    <column data-key="name" header-text="Name"></column> 
    <column data-key="address" header-text="Address" ></column> 
    <column data-key="submit" header-text="Submit"></column> 
    </columns> 
</wij-grid>  

내 각 JS 코드는 여기

$http.get(url,data).success(
     loadData); 

function loadData(responseData) { 
if (responseData != null) { 
    var data = responseData; 
    for (index = 0; index < data.length; index++) { 
     data[index].address = data[index].addressLineOne+","+data[index].addressLineTwo;         
     $SubmitBtn = "<a href='javascript:void(0);ng-click='submitCode("+data[index].reviewId+",true)'>Approve</a>"; data[index].submit=$ASubmitBtn;          
    } 
    $scope.data = data; 
    $("#content").wijtabs(); 
    } 
}  
$scope.submitCode= function(id, status) { 
alert(id+" "+status) 
} 

은 저를 도와주세요 wijgrid 모듈에서 컴파일되지 않음을 의미하는 .. 코드 함수가 호출되지 않고 소스보기에서 함수가 ID와 상태로 표시되어 제출 해결책을 제공하십시오. 나는 코드 $ compile ($ sumitBtn) ($ scope)을 컴파일하려고 시도했지만 작동하지 않는다. 제발 나에게 제안 해주세요.

답변

0

나는 내 요구 사항에 따라 코드를 변경이 cellformatter 방법을 사용하여 솔루션을 가지고

$scope.formatter = function(args) { 
if(args.row.dataRowIndex < 0) 
return false; 
args.$container 
.html($compile(
args.formattedValue) 
($scope)); 
return true;  
} 
1

Wijmo는이 문제를 알고 있으며 알려진 버그라고 말합니다.

$scope.cellStyleFormatter = function(args) { 
    if ((args.row.type & wijmo.grid.rowType.data) && (args.row.state & wijmo.grid.renderState.rendering)) { 
     var content = args.$cell[0].innerHTML; 
     //Here I have button html already in my grid data, using 
     //'my-link-class' css 
     if(content.indexOf("my-link-class") > -1) { 
      var scope = angular.element("#grid-container").scope(); 
      args.$cell 
       .empty() 
       .append($(content).click(function() { 
        scope.myControllerClickHandler(); 
       }) 
      ); 
     } 
     return true; 
    } 
    }; 

그리고 나는 그렇게처럼 내 그리드를 선언 : 내가 사용하고 해결 방법은 이것이다 나는 전체 그리드에 전 세계적으로 적용 할 수 있기 때문에 위의 cellStyleFormatter을 사용하고

<wij-grid data="template.model.content" allow-editing="false" cellStyleFormatter="cellStyleFormatter"> 
     <columns> 
     <column dataKey="col_0" ></column> 
     </columns> 
    </wij-grid> 

. 미리 컬럼을 알고 있다면 cellFormatter를 사용할 수 있습니다 (어플리케이션에 가변 개수의 컬럼이 있기 때문에 이것이 나에게 옵션이 아니 었습니다). args.container 대신 args를 참조 할 것입니다. cellFormatter를 사용하는 경우 $ cell. 여기

는 wijmo의 설명에 대한 링크입니다 : http://wijmo.com/topic/wig-grid-with-angularjs-how-to-handle-click-on-a-link-in-a-cell/

+0

안녕 에드워즈, 당신의 답장을 보내 주셔서 감사합니다, 나는 노력이 예 previosly 정적 데이터에 대해서만 작동하지만 ..이 경우 나는 동적으로 데이터를 받고 reviewId와 함께 호출 이벤트 함수를 사용합니다. 이 경우 cellFormater 및 cellStyleFormatter를 사용할 수 없으므로이 방법을 사용하는 것이 좋습니다. – Satish

+0

런타임 중에 데이터가 변경된다는 의미입니까? 내 데이터도 원격 서비스에서 가져온 것이지만 컨트롤러가 wij-grid를 파괴하고 다시 만드는 것과 같은 그리드를 다시로드하고 다시 인스턴스화하게하는 모든 업데이트에 대해 $ location.path를 업데이트합니다. 또한 프로젝트가 wijmo를 포기하는 것이 너무 늦지 않은 경우, 아마도 이것이 가장 좋은 코스 일 것입니다. –

관련 문제