2016-05-10 6 views
0

問題があります。アルファベット順の表データをAngular.js dir-paginateで並べ替えることはできません。現在のページのソートデータ。私は以下のコードを説明しています。この場合Angular.jsでページ区切りを使用しているときに表データをアルファベット順にソートできない

<tbody id="detailsstockid"> 
<tr dir-paginate="cus in ($parent.labelResults=(listOfCustomerData | filter:searchProduct.rest_name)) | itemsPerPage:5 | orderBy:'rest_name' track by $index" current-page="currentPage"> 
<td>{{itemsPerPage *(currentPage-1)+$index+1}}</td> 
<td>{{cus.rest_name}}</td> 

<td>{{cus.quadrant_name}}</td> 
<td>{{cus.city}}</td> 
<td>{{cus.proviance}}</td> 

<td>{{cus.person}}</td> 
<td>{{cus.mobile}}</td> 
<td>{{cus.url}}</td> 
    <td ng-if="cus.status==1">Active</td> 
<td ng-if="cus.status==0">Inactive</td> 
<td ng-if="cus.premium==1">Yes</td> 
<td ng-if="cus.premium==0">No</td> 
<td > 
<a ui-sref="dashboard.customer.view"> 
<input type='button' class='btn btn-xs btn-green' value='Edit' ng-click="editProductViewData(cus.member_id);"> 
</a> 
</td> 
<td> 
<a ui-sref="dashboard.customer.view"> 
<input type='button' class='btn btn-xs btn-red' value='Delete' ng-click="deleteProductInfoData(cus.member_id);" > 
</a> 
</td> 
</tr> 
</tbody> 

私は、現在のページのみのデータを並べ替えることができますが、私は.Iは、以下の私の出力を添付しています合計配列(i.e-listOfCustomerData)からのデータをソートする必要があります。

enter image description here

は、この上のPICで店舗名は、cから始めて、これは1ページ写真です。

enter image description here

2ページのためにレストランの名前は、私は、すべてのレストランでは、アルファベット順で並べ替えが、page.Pleaseごとに私を助けてはならない必要above.Hereを与えられているBから始めています。

+0

ページを変更する前にソートを試しましたか? 'orderBy: 'rest_name' | itemsPerPage:5 |の代わりに 'itemsPerPage:5'を使用します。 orderBy: 'rest_name'' –

+0

私にそれをさせてください。 – satya

+0

@DanielBeck:はい、それは働き始めました。ありがとうございます。 – satya

答えて

2

フィルタをチェーンする順序が重要です。

<tr dir-paginate="... | itemsPerPage:5 | orderBy:'rest_name' ..."> 

を...ので、ソートはページネーションフィルタを通過したソートされていないリストの部分に影響を与えます。現在、あなたは、ソート前ページ付けています。

この場合、必要なのはその順番を入れ替えるだけで、代わりにページを並べ替えることです。リスト全体が最初にソートされ、別のページに分割されます。

... | orderBy:'rest_name' | itemsPerPage:5 ...

0

はい、できます。

並べ替えの場合は、のすべてで動作するように試してみてください。this

paginationの場合は、ご使​​用のバージョンの代わりにexampleを組み合わせることができます。

関連する問題