omines / datatables-bundle

DataTables bundle for Symfony
https://omines.github.io/datatables-bundle/
MIT License
258 stars 115 forks source link

cant add request fields #89

Closed vladprokopchuk closed 5 years ago

vladprokopchuk commented 5 years ago

hi. Im trying to add some additional filters for table:

$('#presidents').initDataTables({{ datatable_settings(datatable) }}, {
                    searching: true,
                    dom: '<"html5buttons"B>lTfgitp',
                    pagingType: "numbers",
                    ajax: {
                        data: function (d) {
                            d.environment_id = $('#environment').val();
                        }
                    }
                }).then(function (dt) {
                    dt.on('draw', function () {

                    })
                }); 

But as I can see

data: function (d) {
                            d.environment_id = 207;
                        }

was ignoring and requests sent without it. How I can fix it?

curry684 commented 5 years ago

@shades684 you remember how to do this?

vladprokopchuk commented 5 years ago

I already found solution. I refactored bundle/datatable.js

vladprokopchuk commented 5 years ago

but if it possible to make fix in repo will be great, for future pulls

curry684 commented 5 years ago

What did you actually change then?

vladprokopchuk commented 5 years ago

` (function($) { /**

curry684 commented 5 years ago

That's too much to include generically, we'll just keep it as is then :)

vladprokopchuk commented 5 years ago

actualy this is full source file content, my refactoring includes 6 rows....

curry684 commented 5 years ago

I can't see that from 3 screens of unformatted code....

By all means make a PR so we can properly review it.