src/Grid/Filter/Presenter/Select.php 1 location
|
@@ 76-91 (lines=16) @@
|
| 73 |
|
* |
| 74 |
|
* @return $this |
| 75 |
|
*/ |
| 76 |
|
protected function loadRemoteOptions($url, $parameters = [], $options = []) |
| 77 |
|
{ |
| 78 |
|
$ajaxOptions = [ |
| 79 |
|
'url' => $url.'?'.http_build_query($parameters), |
| 80 |
|
]; |
| 81 |
|
|
| 82 |
|
$ajaxOptions = json_encode(array_merge($ajaxOptions, $options)); |
| 83 |
|
|
| 84 |
|
$this->script = <<<EOT |
| 85 |
|
|
| 86 |
|
$.ajax($ajaxOptions).done(function(data) { |
| 87 |
|
$(".{$this->getElementClass()}").select2({data: data}); |
| 88 |
|
}); |
| 89 |
|
|
| 90 |
|
EOT; |
| 91 |
|
} |
| 92 |
|
|
| 93 |
|
/** |
| 94 |
|
* Load options from ajax. |
src/Form/Field/Select.php 1 location
|
@@ 245-262 (lines=18) @@
|
| 242 |
|
* |
| 243 |
|
* @return $this |
| 244 |
|
*/ |
| 245 |
|
protected function loadRemoteOptions($url, $parameters = [], $options = []) |
| 246 |
|
{ |
| 247 |
|
$ajaxOptions = [ |
| 248 |
|
'url' => $url.'?'.http_build_query($parameters), |
| 249 |
|
]; |
| 250 |
|
|
| 251 |
|
$ajaxOptions = json_encode(array_merge($ajaxOptions, $options)); |
| 252 |
|
|
| 253 |
|
$this->script = <<<EOT |
| 254 |
|
|
| 255 |
|
$.ajax($ajaxOptions).done(function(data) { |
| 256 |
|
$("{$this->getElementClassSelector()}").select2({data: data}); |
| 257 |
|
}); |
| 258 |
|
|
| 259 |
|
EOT; |
| 260 |
|
|
| 261 |
|
return $this; |
| 262 |
|
} |
| 263 |
|
|
| 264 |
|
/** |
| 265 |
|
* Load options from ajax results. |