Message
 
 
To
All
General information
Forum:
Javascript
Category:
Other
Title:
Initial selection
Miscellaneous
Thread ID:
01643061
Message ID:
01643061
Views:
41
UPDATE. It helps to post the question on UT. After I posted it I immediately solved this problem myself.

Hi everybody,

I have the following in the markup of my page
<data-sm:duallist-directive ng-required="false"
                                        unassigned-items-title="'@String.Format(Labels.availableX, Labels.categories)'"
                                        unassigned-items="currentBenefit.unassignedCategories"
                                        assigned-items-title="'@String.Format(Labels.assignedX, Labels.categories)'"
                                        assigned-items="currentBenefit.assignedCategories"
                                        sortable="false"
                                        filter-criteria="{departmeId:currentBenefit.selectedDepartmentId}"
                                        selected-item="currentBenefit.selectedCategory">
            </data-sm:duallist-directive>
And the directive has the following template
<div>
                <select class="select-list"
                        ng-change="onChanged(assigned)" 
                        multiple
                        ng-model="assigned"
                        name="assignedList"
                        ng-options="assignedItem.descrip for assignedItem in assignedItems| orderBy: 'SortOrder' | filter: filterCriteria">
                </select>
            </div>
Please note that ng-options have filter.

Now, in my controller I try to assign

$scope.currentBenefit.selectedDepartmentId = null (I tried 0 as well).

Unfortunately, in my initial loading of the page I can see all items loaded in the list. Only when I start changing the value in the drop down (which has currentBenefit.selectedDepartmentId as ng-model) my list became filtered.

What should I change to make the initial selection filtered?

Thanks in advance?
If it's not broken, fix it until it is.


My Blog
Reply
Map
View