[Suitecrm]解决sugarcrm suitecrm 输入autocomplete的问题Quicksearch

2015年6月13日13:32:26 发表评论 2,073 views



Sugar uses a type-ahead combo box system called QuickSearch that utilizes components from the YUI framework.



The Sugar QuickSearch (SQS) code resides in the file ./include/javascript/quicksearch.js. This file, along with the YUI dependencies are grouped into ./include/javascript/sugar_grp1_yui.js which is loaded in all the main pages of Sugar. A custom YUI AutoComplete widget is used to pull data through an AJAX call to http://{site_url}/index.php. This then accesses the file ./modules/Home/quicksearchQuery.php.

The browser initiates an AJAX call through JavaScript to the server a short delay after the last user input takes place in the browser. A call is then made requesting up to 30 results per result set.

The first ten results are displayed in the browser. If the user refines the search, and the result set is a subset of the first call then no additional call is made. If the result set of the first call is equal to the limit (30), then an additional call is made.

Requirements for a QuickSearch Field

Requirements for a QuickSearch field are listed below:

  • Class of the field is set to sqsEnabled
  • Field is not set to disabled or readOnly
  • JS array sqs_objects is defined and contains the field name
  • sugar_grp1_yui.jsmust be loaded on the page

Disabling Automatic Filling

Add the string sqsNoAutofill to the field class to disable automatic filling of the field on blur.

Metadata example:

array (
    'name' => 'account_name',
    'displayParams' => array (
        'hiddeButtons' =>'true',
        'size' => 30,
        'class' => 'sqsEnabled sqsNoAutofill'

Imposing a Delay in QuickSearch

On high performance systems, QuickSearch querying can lead to unintended results because the query returns quickly before the user has finished typing the full string they wish to search. A system administrator can enforce a strict delay on quicksearch fields so that a search will not be performed until X number of seconds have elapsed after a user last stopped typing. To add this parameter, open the ./config_override.php file and enter the following code:

$sugar_config['quicksearch_querydelay'] = 1;

The value is in whole seconds and it is recommended not to exceed 1 second unless explicitly requested by your users. Anything longer than 1 second could be seen as an annoyance due to an extended wait. Once this code is entered, save the file. Users will need to log out and clear their browser cache before this change is reflected in their instance of Sugar.

  • 我的微信
  • 这是我的微信扫一扫
  • weinxin
  • 我的微信公众号
  • 我的微信公众号扫一扫
  • weinxin
0 0 投票数

0 评论