0

Is there a way to set the value of the search box that autogenerates with the tables, because I have a form and in that form is a select and I want to put the value that the user selects from that select into the search box.

I know that angular-datatables have a column filter plugin and that filter can be a select , but that column filter select doesn't have an autocomplete and my select have like 2000 options.

So that's why I want to set the value of the search box with the value that the user selects in the select that I have in my form. is this possible?

here is my form

<div class="form-group" ng-cloak>
                    <ui-select ng-model="ctrl.client.selected" 
                               ng-change="selectClientClick()">
                        <ui-select-match allow-clear="true" placeholder="Select a Client">{{$select.selected.name}}</ui-select-match>
                        <ui-select-choices repeat="item in clientList | filter: $select.search">
                            <div ng-bind-html="item.name | highlight: $select.search"></div>
                        </ui-select-choices>
                    </ui-select>
</div>

<div class="table-responsive">
                <table datatable="" dt-options="ctrl.dtOptions" dt-columns="ctrl.dtColumns" class="table table-striped table-bordered" width="100%"></table>
</div>

here is the code that creates my table

var vm = this;
            vm.dtOptions = DTOptionsBuilder.fromSource('jsonData')
                    .withPaginationType('full_numbers')
                    // Add Bootstrap compatibility
                    .withBootstrap()
                    // Active Responsive plugin
                    .withOption('responsive', true)

                    ;

            vm.dtColumns = [
                DTColumnBuilder.newColumn('name').withTitle('name'),
                DTColumnBuilder.newColumn('alias').withTitle('alias')
            ];

Is there a way or a option in angular-datatables where I can assing the value of the search box like this search_box_value = $scope.ctrl.client.selected.name

Edit 1: I'm using angularjs 1.5.7 and this angulajs-datatables https://github.com/l-lin/angular-datatables/ and I just finished this example https://l-lin.github.io/angular-datatables/#/withResponsive I have the same code that is in that example, except for the select that I added. I'm not using any other plugin and I'm not using server side pagination I get my data from a RESTFUL web services that return a Json, I don't think that I ned server side pagination since I think that I would be managing no more than 2000 rows

Bill_Data23
  • 659
  • 2
  • 14
  • 30
  • Provide the link of the module that you're using then we can help. – developer033 Jul 11 '16 at 15:06
  • I'm using angularjs 1.5.7 and this angulajs-datatables https://github.com/l-lin/angular-datatables/ and I just finished this example https://l-lin.github.io/angular-datatables/#/withResponsive I have the same code that is in that example, except for the select that I added in my question – Bill_Data23 Jul 11 '16 at 15:08
  • are you using server side pagination? – Vanojx1 Jul 11 '16 at 15:08
  • no @Vanojx1 Im not using server side pagination I edited my question – Bill_Data23 Jul 11 '16 at 15:12
  • Check it: http://stackoverflow.com/questions/34846666/angularjs-with-datatable-custom-search-box. Also I recommend you to use this to manage your tables: http://lorenzofox3.github.io/smart-table-website/ – developer033 Jul 11 '16 at 15:39

0 Answers0