Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Date filter is ignored
Message
From
29/05/2015 03:16:50
 
General information
Forum:
Javascript
Category:
Other
Miscellaneous
Thread ID:
01620266
Message ID:
01620314
Views:
40
This message has been marked as a message which has helped to the initial question of the thread.
Don't know why having multiple bindings to the same model object would be a problem. What exactly was going wrong?

You can chain filters in the view but it's probably better to create a filtered object on the model so that it's not repeatedly evaluated by the $digest.....


>I got it working. The problem was that the transactionDate was also bound to another control (in a directive) at that same form. The newTransact object has another dateTime column which is the same as transactionDate (in fact, the transactionDate is created to feed that directive). So, I just used that dateTime column at the top and now it displays correct info.
>
>Tricky!
>
>I have a bit unrelated question.
>
>I have the following code:
>
>
>  <table  id="transactionsList" ng-show="invoiceTransactionsObject.transactions.length>0"
>                       class="table table-bordered table-hover table-list">
>                    <thead>
>                        <tr>
>                            <td>Trans No</td>
>                            <td>@Labels.quantity</td>
>                            <td>@Labels.message</td>
>                            <td>@Labels.item</td>
>                            <td>@Labels.amount</td>
>                            <td>@Labels.CreatedBy</td>
>                            <td>@Labels.CreatedOn</td>
>                        </tr>
>                    </thead>
>                    <tbody>
>                        <tr ng-repeat="trans in invoiceTransactionsObject.transactions | filter:searchTerm">
>                            <td>{{trans.transNo}}</td>
>                            <td>{{trans.quantity}}</td>
>                            <td>{{trans.message}}</td>
>                            <td>{{trans.item}}</td>
>                            <td><span ng-class="{'negative-amount' : trans.extension < 0}">{{trans.extension | currency}}</span></td>
>                            <td>{{trans.operator}}</td>
>                            <td>{{trans.dateTime | date: 'MM-dd-yyyy'}}</td>
>                        </tr>
>                    </tbody>
>
>Note the filter in ng-repeat directive. The problem is that I also have 2 date controls on that form
>
><div class="row">
>            <div class="col-md-4 col-md-offset-1">
>                <data-sm:date-time-picker ng-model="startDate" pick-time="true"
>                                          is-date-range="true" form="form" data-no:dirty-check="true"
>                                          compare-date="endDate" name="startDate"></data-sm:date-time-picker>
>            </div>
>            <div class="col-md-4 col-md-offset-0">
>                <data-sm:date-time-picker ng-model="endDate" pick-time="true"
>                                          is-date-range="true" form="form"
>                                          compare-date="startDate" data-no:dirty-check="true"
>                                          is-end-date="true"
>                                          name="endDate"></data-sm:date-time-picker>
>            </div>
>            <button class="col-md-3 btn" ng-click="filterByDate()">@Labels.filter</button>
>        </div>
>
>So, if these dates (or one of them) are populated, I want to also apply the dates filter. I found http://stackoverflow.com/questions/25515431/ng-repeat-filtering-data-by-date-range so I plan to create a custom dateRange filter (need to somehow make it more generic to allow to pass date column name), but I am wondering how can I combine 2 filters?
>
>Thanks in advance.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform