【问题标题】:No column sort with a non-db calculated field in listview SugarCRM在 listview SugarCRM 中没有使用非 db 计算字段的列排序
【发布时间】:2013-09-02 20:50:56
【问题描述】:

我创建了一个计算字段,在我的 vardefs 中,该字段是非 db、可排序和类型 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

【问题讨论】:

    标签: sorting sugarcrm calculated-field


    【解决方案1】:

    很遗憾,您不能按非 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,
      ),
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-11-26
      • 1970-01-01
      • 2016-08-25
      • 2018-04-12
      • 1970-01-01
      相关资源
      最近更新 更多