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

5

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.