mgallegos / laravel-jqgrid

@Laravel jqGrid package allows you to easily integrate the popular @jQuery Grid Plugin (jqGrid) into your Laravel application.
mariogallegos.com
Other
69 stars 44 forks source link

add between op (for example needed in dateranges) #46

Closed KrasilnikovKB closed 8 years ago

KrasilnikovKB commented 8 years ago

After this update we can do some like this:

<script type="text/javascript" src="//cdn.jsdelivr.net/momentjs/latest/moment.min.js"></script>
<link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/bootstrap/latest/css/bootstrap.css" />
<!-- Include Date Range Picker -->
<script type="text/javascript" src="//cdn.jsdelivr.net/bootstrap.daterangepicker/2/daterangepicker.js"></script>
<link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/bootstrap.daterangepicker/2/daterangepicker.css" />
   GridRender::setGridId("exampleGrid")

->addColumn(array(
    'label'=>'Date field',
    'index'=>'date_field',
        'formatter' => 'date',
        'formatoptions' => [ 'srcformat' => 'd.m.Y H:i', 'newformat' => 'd.m.Y H:i'],
        'searchoptions' => [
                        'sopt' =>array('btw'),

                        'dataInit' => preg_replace('/\s+/m', ' ', 'function(el){$(el).daterangepicker(
                              '.json_encode([
                                              "locale" => [
                                                              "format" => "YYYY-MM-DD",
                                                              "separator" => " - ",
                                                          ],
                                              "ranges" => [
                                                              "Today" => 'JS>>>[moment(), moment()]<<<JS',
                                                              "This month" => 'JS>>>[moment().startOf(\'month\'), moment().endOf(\'month\')]<<<JS',
                                                              "Last month" => 'JS>>>[moment().subtract(1, \'month\').startOf(\'month\'), moment().subtract(1, \'month\').endOf(\'month\')]<<<JS'
                                                          ],
                                            ], JSON_UNESCAPED_UNICODE).'
                              ,

                               function(start, end, label){
                                  setTimeout(function () {
                                      var grid = $(\'#exampleGrid\');
                                          grid[0].triggerToolbar();
                                  }, 50);
                               });

                               $(el).val("");

                               }'),

                       ],
                   )
             )

and we got result some like this (on image all text on russian :wink: ): image

mgallegos commented 8 years ago

Hi, I was looking the changes in EloquentRepositoryAbstract.php, I think you should remove the \Log::info lines.

Everything else looks great!

mgallegos commented 8 years ago

Forget it, they were removed.

I'm going to merge it .