@@ -160,12 +160,30 @@ public function parameterize($attributes = [])
160160 {
161161 $ parameters = (new Parameters ($ attributes ))->toArray ();
162162
163+ $ values = [];
164+ $ replacements = [];
165+ foreach ($ parameters as $ key => &$ value ){
166+ if (!is_array ($ value )) {
167+ if (strpos ($ value , '$. ' ) === 0 )
168+ {
169+ // Store function string.
170+ $ values [] = $ value ;
171+ // Replace function string in $foo with a 'unique' special key.
172+ $ value = '% ' . $ key . '% ' ;
173+ // Later on, we'll look for the value, and replace it.
174+ $ replacements [] = '" ' . $ value . '" ' ;
175+ }
176+ }
177+ }
178+
163179 list ($ ajaxDataFunction , $ parameters ) = $ this ->encodeAjaxDataFunction ($ parameters );
164180 list ($ columnFunctions , $ parameters ) = $ this ->encodeColumnFunctions ($ parameters );
165181 list ($ callbackFunctions , $ parameters ) = $ this ->encodeCallbackFunctions ($ parameters );
166182
167183 $ json = json_encode ($ parameters );
168184
185+ $ json = str_replace ($ replacements , $ values , $ json );
186+
169187 $ json = $ this ->decodeAjaxDataFunction ($ ajaxDataFunction , $ json );
170188 $ json = $ this ->decodeColumnFunctions ($ columnFunctions , $ json );
171189 $ json = $ this ->decodeCallbackFunctions ($ callbackFunctions , $ json );
@@ -511,6 +529,20 @@ public function addIndex(array $attributes = [])
511529 return $ this ;
512530 }
513531
532+ /**
533+ * Setup ajax parameter for datatables pipeline plugin
534+ *
535+ * @param string $url
536+ * @param string $pages
537+ * @return $this
538+ */
539+ public function pipeline ($ url , $ pages )
540+ {
541+ $ this ->ajax = "$.fn.dataTable.pipeline({ url: ' {$ url }', pages: {$ pages } }) " ;
542+
543+ return $ this ;
544+ }
545+
514546 /**
515547 * Setup ajax parameter
516548 *
0 commit comments