@@ 38-59 (lines=22) @@ | ||
35 | public $_primaryFilter = 'descr'; |
|
36 | ||
37 | /** {@inheritdoc} */ |
|
38 | public function getPluginOptions($options = []) |
|
39 | { |
|
40 | return parent::getPluginOptions([ |
|
41 | 'select2Options' => [ |
|
42 | 'templateResult' => new JsExpression("function (data) { |
|
43 | if (data.loading) { |
|
44 | return data.text; |
|
45 | } |
|
46 | var client = '<b>' + data.client + ': ' |
|
47 | color = data.sum < 0 ? 'text-danger' : 'text-success'; |
|
48 | sum = ' <span class=\"' + color +'\">' + data.sum + '</span> ' |
|
49 | currency = ' ' + data.currency.toUpperCase() + '</b><br>' |
|
50 | descr = (data.descr ? data.descr : data.label); |
|
51 | ||
52 | return client + sum + currency + (descr ? descr : '<span class=\"text-muted\">--</span>'); |
|
53 | }"), |
|
54 | 'escapeMarkup' => new JsExpression('function (markup) { |
|
55 | return markup; // Allows HTML |
|
56 | }'), |
|
57 | ], |
|
58 | ]); |
|
59 | } |
|
60 | ||
61 | /** {@inheritdoc} */ |
|
62 | public function getFilter() |
@@ 28-44 (lines=17) @@ | ||
25 | ||
26 | public $_primaryFilter = 'name_ilike'; |
|
27 | ||
28 | public function getPluginOptions($options = []) |
|
29 | { |
|
30 | return parent::getPluginOptions([ |
|
31 | 'select2Options' => [ |
|
32 | 'templateResult' => new JsExpression("function (data) { |
|
33 | if (data.loading) { |
|
34 | return data.text; |
|
35 | } |
|
36 | ||
37 | return data.name + '<br>' + data.email; |
|
38 | }"), |
|
39 | 'escapeMarkup' => new JsExpression('function (markup) { |
|
40 | return markup; // Allows HTML |
|
41 | }'), |
|
42 | ], |
|
43 | ]); |
|
44 | } |
|
45 | ||
46 | /** {@inheritdoc} */ |
|
47 | public function getFilter() |