javascript - AngularJS search filters -- 1st filter : all , 2nd Filter :specific column -
what doing : angular using 2 filters same model. first 1 must going filter whole model , other filter must filter specific column statusid wherein did filtering through dropdown. here's code.
<div class="col-xs-4"> <div class="col-xs-10"> <h4><b>search :</b></h4> <div class="input-group"> <span class="input-group-addon"> <span class="glyphicon glyphicon-search"></span> </span> <input type="text" name="search" data-ng-model="filter" class="form-control" placeholder="search here (e.g. 151234 or pille)" /> </div> </div> <div class="col-xs-10"> <h4><b>search status :</b></h4> <div class="input-group"> <select data-ng-model="filter.statusid" class="form-control"> <option value="" selected>-- select status --</option> <option value="1"> new </option> <option value="2"> processing </option> <option value="3"> pr approved </option> <option value="4">qouting</option> <option value="5">qouting approved</option> <option value="6">po processing</option> <option value="7">closed</option> <option value="8">cancelled</option> <option value="9">rejected</option> <option value="10">po issued</option> <option value="11">on delivery</option> <option value="12">received</option> <option value="13">ap posting</option> <option value="14">payment</option> <option value="15">sourcing</option> <option value="16">re-processing</option> </select> </div> </div> </div> </div>
actually code working if 1 of filters used . wanted work together. when use dropdown [object] [object] occurs on textbox.
when i'll search on first search box , can still use dropdown filtering filtered result.
does understand trying ?
here need use 2 filters , 1 is , 1 filtering column.
<div class="col-xs-4"> <div class="col-xs-10"> <h4><b>search :</b></h4> <div class="input-group"> <span class="input-group-addon"> <span class="glyphicon glyphicon-search"></span> </span> <input type="text" name="search" data-ng-model="filterallcolumns" class="form-control" placeholder="search here (e.g. 151234 or pille)" /> </div> </div> <div class="col-xs-10"> <h4><b>search status :</b></h4> <div class="input-group"> <select data-ng-model="filteroptions.statusid" class="form-control"> <option value="" selected>-- select status --</option> <option value="1"> new </option> <option value="2"> processing </option> <option value="3"> pr approved </option> <option value="4">qouting</option> <option value="5">qouting approved</option> <option value="6">po processing</option> <option value="7">closed</option> <option value="8">cancelled</option> <option value="9">rejected</option> <option value="10">po issued</option> <option value="11">on delivery</option> <option value="12">received</option> <option value="13">ap posting</option> <option value="14">payment</option> <option value="15">sourcing</option> <option value="16">re-processing</option> </select> </div> </div> </div> </div>
and filter array :
<div data-ng-repeat="item in mymodels | filter : filterallcolumns|filteroptions"></div>
when click on dropdown ,in textbox see [object object], in textbox ng-model should string type when click on dropdown ng-model filter.statusid javascript object assigned model dropdown, when click on dropdown angularjs create object of filter , assigns value filter.statusid. should careful of going object , string etc..,
Comments
Post a Comment