stPipe
function using some button ? The function gets triggered on search, sort action. I want to be able to trigger the same function using some buttons. These buttons serve as filter functions. I can write the function and bind it to ng-click of that button but not sure how to trigger the table's stPipe
function and how to access the tableState
<table class="table table-hover" st-table="shoplists" st-safe-src="shoplists_data" >
$http
service, or something else, something non-Angular?
.factory('Shop',['$resource',function($resource){
var obj={};
obj=$resource('http://127.0.0.1:8080/api/shops');
obj.baseinfo=$resource('http://127.0.0.1:8080/api/shops/baseinfo');
obj.getNotVerifyShops=$resource('http://127.0.0.1:8080/api/shops/getNotVerifyShops',{},{isArray:true});
obj.getShopByQuery=$resource('http://127.0.0.1:8080/api/shops/getShopByQuery',{},{ isArray:true});
return obj;
}])
<div>Data count: {{shoplist_data.length}}</div>
$scope.shoplists = [];
$scope.shoplists_data = [];
function getNotVerifyShops() {
Shop.getNotVerifyShops.query(function(data){
console.log(data);
$scope.shoplists_data = data;
// $scope.shoplists = data;
})
}
getNotVerifyShops()
<div>Data count: {{shoplist_data.length}}</div>
<table class="table table-hover" st-table="shoplists" st-safe-src="shoplists_data" >
<thead>
<tr class="sortable">
<th class="table-id" st-sort="shopId" st-sort-default="true">编号</th>
<!-- <th st-sort="area">区域</th> -->
<th st-sort="company">申请公司</th>
<th st-sort="person">联系人</th>
<th st-sort="phone">手机号码</th>
<th st-sort="state">当前状态</th>
<th st-sort="date">最近提交时间</th>
<th st-sort="zaozuo">操作</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="item in shoplists_data" class="editable-tr-wrap">
<td class="table-id">{{item.shopId}}</td>
<!-- <td>{{item.area}}</td> -->
<td>{{item.companyName}}</td>
<td>{{item.shopApplyUserId.name}}</td>
<td>{{item.shopApplyUserId.cellphone}}</td>
<td>{{test(item.applyId.verify)}}</td>
<td>{{spliceTime(item.meta.createAt)}}</td>
<!-- <td>{{item.date}}</td> -->
<td><a ui-sref="components.check({obj:item._id})">审核</a></td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="8" class="text-center">
<div st-pagination="" st-items-by-page="5" st-displayed-pages="5"></div>
</td>
</tr>
</tfoot>
</table>
st-safe-src
is very badly documented on the Smart-Table site. They do however show that st-table
should point to "displayed" data, but I don't think there is any mention of what that means and what "displayed" data should be
Hi i have a quick question about the custom pagination docs in angular smart table, it appears that on your site it is currently broken. I did at one point develop a custom pagination like this before
<nav ng-if="pages.length >= 2">
<ul class="pagination">
<li><a ng-click="selectPage(1)">First</a>
</li><li><a ng-click="selectPage(currentPage - 1)"><</a>
</li><li><a> {{currentPage}} of {{numPages}}</a>
</li><li><a ng-click="selectPage(currentPage + 1)">></a>
</li><li><a ng-click="selectPage(numPages)">Last</a></li>
</ul>
</nav>