我在yii中使用 onLoadUser: function (user) {
Actions.loadUser.completed(user); // at this place catch error
},
onLoadUserCompleted: function (user) {
this.setCurrentUser(user);
},
setCurrentUser(user) {
currentUser = {
user_id: user.user_id,
token: user.access_token,
username: user.username,
email: user.email
}
},
getCurrentUser() {
return currentUser;
},
作为网格,问题在于它需要第一个完整数据然后它在数据提供者中给出限制,这需要花费太多时间来加载,所以我想做自定义总计数arraydata提供者,我做了一些东西,但它给了我错误,这是我的代码
CArrayDataProvider
对于$ rawDataWithArray,我设置了限制因此它将给出10个记录,对于$ rawDataCount我设置了总计数,对于我获得正确数据的变量,所以没有数据问题,当我设置itemCount时给我错误$rawDataWithArray = $modelMemberreceipt->getMemberReceiptListWithLimit($searchString,$PageSize,$currentPage);
$filteredData=$filtersForm->filter($rawDataWithArray);
$rawDataCount = $modelMemberreceipt->getMemberReceiptListItemCount($searchString);
$model = new CArrayDataProvider($rawDataWithArray, array(
'keyField' => 'ReceiptID',
'itemCount' => $rawDataCount,
'sort' => array(
'attributes' => array(
'ReceiptID','StoreName','member','LoyaltyCardNo','MerchantTypeID',
'ReceiptAmount','ReceiptDate','Status','Created','Updated','RejectionReasonCode','ProcessingReason',
'UpdatedBy','ScannedReceiptNo'
),
'defaultOrder' => $sortArray,
),
'pagination' => array(
'pageSize' => $PageSize,
'currentPage'=>$currentPage,
),
));
,有人可以告诉我如何解决这个问题?
答案 0 :(得分:1)
SELECT * FROM (
select country.country, count(customer.customer_id) as country_count
from customer
join address on customer.address_id = address.address_id
join city on address.city_id = city.city_id
join country on city.country_id = country.country_id
group by country.country_id
order by country_count desc) t
WHERE rownum < 11;
返回当前页面中的数据项数。它将自动计算。
我认为您需要设置itemCount
而不是totalItemCount
:
itemCount