我创建了一个计算字段,在我的vardefs中,字段是非db,sortable和type varchar。我有一个关于检索的逻辑钩子和一个计算功能,就像编辑和列表视图中的魅力一样。但是当我点击列名计算字段(listview)时,查询返回0条记录。
我尝试了几件事但没有成功,我错过了一些东西。
点击计算列时的查询(field ='difference_c'):
SELECT aos_quotes.id , aos_quotes.number , aos_quotes.name , aos_quotes.stage , aos_quotes.billing_contact_id, LTRIM(RTRIM(CONCAT(IFNULL(jt0.first_name,''),' ',IFNULL(jt0.last_name,'')))) billing_contact , aos_quotes.billing_account_id, jt1.name billing_account , aos_quotes.total_amount , aos_quotes.currency_id , aos_quotes.expiration , LTRIM(RTRIM(CONCAT(IFNULL(jt2.first_name,''),' ',IFNULL(jt2.last_name,'')))) assigned_user_name , jt2.created_by assigned_user_name_owner , 'Users' assigned_user_name_mod, aos_quotes.date_entered , aos_quotes.enddate_c , aos_quotes.startdate_c , aos_quotes.assigned_user_id FROM aos_quotes LEFT JOIN contacts jt0 ON aos_quotes.billing_contact_id = jt0.id AND jt0.deleted=0 LEFT JOIN accounts jt1 ON aos_quotes.billing_account_id = jt1.id AND jt1.deleted=0 LEFT JOIN users jt2 ON aos_quotes.assigned_user_id=jt2.id AND jt2.deleted=0 AND jt2.deleted=0 where aos_quotes.deleted=0 ORDER BY difference_c ASC
答案 0 :(得分:2)
很遗憾,您无法通过非db字段订购ListView记录。要禁止用户这样做,您应该在listviewdefs.php文件中的字段定义中将'sortable'键设置为false,如:
'MY_CUSTOM_NON-DB_FIELD' =>
array (
'type' => 'char',
'label' => 'LBL_MY_CUSTOM_NON-DB_FIELD',
'width' => '15%',
'sortable' => false,
),