0
SQL 연결을 위해 angularjs를 사용하는 웹 앱을 만들고 있습니다.angularjs 데이터가 표에 표시되지 않습니다.
두 명의 사용자 (admin
, Regional Partner Manager
)가 내 테이블에 admin 데이터가 제대로 표시되지만 지역 파트너 관리자의 데이터가 표시되지 않습니다.
$scope.getsonvindata = function() {
$scope.loadimage = true;
$scope.names = '';
$scope.resetfilters();
//$scope.area = location;
// get sonvin data list and stored in sonvinrpm $scope variable
$http.get('/angularwebservice/frmcosonvinrpm4.asmx/frmsonvinrpm', {
params: {
log: log,
from: $scope.from,
to: $scope.to,
pm: pm
}
})
.then(function (response) {
$scope.sonvinrpm = response.data.procompanysonVin;
console.log($scope.sonvinrpm);
//pagination
$scope.totalItems = $scope.sonvinrpm.length;
$scope.numPerPage = 50000;
$scope.paginate = function (value) {
var begin, end, index;
begin = ($scope.currentPage - 1) * $scope.numPerPage;
end = begin + $scope.numPerPage;
index = $scope.sonvinrpm.indexOf(value);
return (begin <= index && index < end);
};
$scope.loadimage = false;
if ($scope.sonvinrpm == '') {
$scope.errormessage = 'Data Not Found... Please Select Correct Date Range';
}
else {
$scope.errormessage = '';
}
});
내 테이블 :
<table id="table" class="table table-bordered font" style="width: 110%;">
<thead>
<tr class="bg-primary">
<th>Edit</th>
<th><a href="#" ng-click="order('name')" class="erp-tb-a">SrNo</a></th>
<th><a href="#" ng-click="order('date')" class="erp-tb-a">Date</a></th>
<th><a href="#" ng-click="order('venuename')" class="erp-tb-a">Hotel/School</a></th>
<th><a href="#" ng-click="order('venue')" class="erp-tb-a">Venue</a></th>
<th><a href="#" ng-click="order('zone')" class="erp-tb-a">Zone</a></th>
<th><a href="#" ng-click="order('location')" class="erp-tb-a">Location</a></th>
<th><a href="#" ng-click="order('starttime')" class="erp-tb-a">Start Time</a></th>
<th><a href="#" ng-click="order('brand')" class="erp-tb-a">Brand Name</a></th>
<th><a href="#" ng-click="order('program')" class="erp-tb-a">Program</a></th>
<%--<th>Count</th>--%>
</tr>
</thead>
<tbody>
<tr class="bg-primary">
<td><i class="glyphicon glyphicon-filter"></i></td>
<td></td>
<%--<th>SonvinId</th>--%>
<td>
<div class="left-margin form-control-wrapper form-group has-feedback has-feedback">
<input type="text" class="date floating-label erp-input" ng-model="search.date" placeholder="Date">
</div>
</td>
<td>
<input type="text" ng-model="search.venuename" placeholder="Hotel/School" class="erp-input" /></td>
<td>
<input type="text" ng-model="search.venue" placeholder="Venue" class="erp-input" />
</td>
<%--<th>Day</th>--%>
<%--<th>Company</th>--%>
<td>
<input type="text" ng-model="search.zone" placeholder="Zone" class="erp-input" /></td>
<td>
<input type="text" ng-model="search.location" placeholder="Location" class="erp-input"></td>
<td>
<%--<div class="form-control-wrapper"> id="time"--%>
<input type="text" ng-model="search.starttime" class="floating-label erp-input" placeholder="Start Time">
<%--</div>--%>
</td>
<%-- <th>End</th>--%>
<%--<th>Hrs</th>--%>
<td>
<input type="text" ng-model="search.brand" placeholder="Brand Name" class="erp-input" /></td>
<td>
<input type="text" ng-model="search.program" placeholder="Program" class="erp-input" /></td>
</tr>
<%--| filter :{date: mddate,brand: mdbrand, zone: mdzone, location: mdlocation, starttime: mdstart,program: mdprogram,venuename: mdvenuename,venue: mdvenue }--%>
<tr ng-repeat="x in sonvinrpm | orderBy:predicate:reverse | filter:paginate| filter:search">
<td><button type="button" ng-click="getassigntrainerdata(x)" class="btn btn-sm btn-primary" data-controls-modal="modal-from-dom" data-backdrop="static" data-keyboard="true" data-toggle="modal" data-target="#assigntrainermodel"><i class="glyphicon glyphicon-pencil"></i></button></td>
<td>{{x.srno}}</td>
<%--<td>{{x.sonvinid}}</td>--%>
<td>{{x.date}}</td>
<td class="bg-success"><a ng-bind="x.venuename" ng-click="DetailsFunction(x)" class="erp-table-a" data-controls-modal="modal-from-dom" data-backdrop="static" data-keyboard="true" data-toggle="modal" data-target="#Detailsmodel"></a></td>
<td>{{x.venue}}</td>
<%-- <td>{{x.day}}</td>--%>
<%--<td>{{x.company}}</td>--%>
<td>{{x.zone}}</td>
<td>{{x.location}}</td>
<td>{{x.starttime}}</td>
<%--<td>{{x.endtime}}</td>--%>
<%--<td>{{x.hrs}}</td>--%>
<td>{{x.brand}}</td>
<td>{{x.program}}</td>
<%--<td>count</td>--%>
</tr>
<tr>
<td colspan="12"><pagination total-items="totalItems" ng-model="currentPage" max-size="5" boundary-links="true" items-per-page="numPerPage" class="pagination-sm"></pagination></td>
</tr>
</tbody>
</table>
현재 데이터 내 지역 파트너 관리자를위한 웹 서비스에서 점점 오전 :
{"procompanysonVin":[{"srno":1,"sonvinid":null,"id":3401,"date":"22-10-2016","day":"Sat ","company":24,"brand":"QED - TM","zone":"East","location":"Kolkata ","starttime":"10:00","endtime":"12:00","hrs":"02:00:00 ","program":"HBKBH","venuename":" NARAYANA SCHOOL","venue":" SITLA ASANSOL"},{"srno":2,"sonvinid":null,"id":3400,"date":"23-10-2016","day":"Sun ","company":24,"brand":"QED - TM","zone":"East","location":"Kolkata ","starttime":"10:00","endtime":"12:00","hrs":"02:00:00 ","program":"HBKBH","venuename":"NARAYANA SCHOOL","venue":" BENGAL AMBUJA HOUSING COMPLEX AMBUJA DURGAPUR WEST BENGAL"}]}
여기
내 JS 파일입니다 데이터가 내 웹 서비스에 들어오고 있는데, 여기서 무엇이 잘못 되었습니까?참고 : 관리자의 데이터는하지만 지역 파트너 관리자
이 테이블을 표시하기 전에 데이터를로드 시도 작업 링크입니다 리버스 : 조건 :
는 다음 NG-반복 해 orderBy에 추가 범위를 추가? ng-if = "sonvinrpm && search"테이블의 시작 부분에
$ scope에 문제가 있다고 생각합니다.http에서 sonvinrpm이 응답을 받으면 어떤 데이터가 표시 될 수 있습니까? console.log ($ scope.sonvinrpm); ithink는 "$ scope.sonvinrpm = response.procompanysonVin;"이어야합니다. 귀하의 응답에 따라 에서 데이터를 제거하십시오. –
일단 문제가 'filter : search'로 제거 되었다면 문제가 될 수 있습니다. 필터가 제거되면 나중에 추가 할 수 있습니다. '
답변
우선은 내가 당신을 어디에 찾을 수 없습니다입니다 $ scope.getsonvindata 함수를 호출합니다. 함수를 정의하고 있지만 코드의 아무 곳이나 호출하지 않습니다. like
두 번째는 필터를 잘못 적용한 것입니다. 필터로 주문을 설정하는 올바른 방법은 다음과 같습니다.
다음이 https://jsfiddle.net/U3pVM/27907/
출처
2016-10-25 07:18:17
의
테이블에 데이터를 설정하는 동안.then(function()
당신은그러나 사용자가 설정 한 데이터 모델과 같은 설정에서 내 테이블에 인쇄한다
search.zone
,search.location
,search.date
등먼저 데이터 액세스를 위해 키를 수정해야합니다.
두 번째로 HTTP 요청에서 가져 오는 데이터는 배열을 포함하는 개체입니다.
따라서
ng-repeat
(또는 다른 반복 논리)을 사용하여 테이블에 표시 할 데이터를 트래버스해야합니다.셋째,
sonvinrpm
는 객체이다, 그래서 당신은과 함께 교체해야
null
또는undefined
확인을 할 필요가출처
2016-10-25 06:48:21
관련 문제