Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$scope.selectedItem undefined when selector inside tab #1831

Open
elivnjak opened this issue May 5, 2016 · 5 comments
Open

$scope.selectedItem undefined when selector inside tab #1831

elivnjak opened this issue May 5, 2016 · 5 comments

Comments

@elivnjak
Copy link

elivnjak commented May 5, 2016

I am trying to place a sf-link-selector within a tab.

It works when its not in a but as soon as i place it inside it, $scope.selectedItem is undefined.

It seems like it doesn't bind $scope.selectedItem on init when its inside the tab.

Any idea how i can make it work?

Also is it possible to have multiple selectors (if the same time) within one designer?

@MerrittMelker
Copy link

MerrittMelker commented Jul 22, 2016

This is an issue with using dynamic items selector with a tab/tabaset as well. In this example:

<uib-tabset class="nav-tabs-wrapper">
    <uib-tab heading="Advertistements">
        <div class="form-group">
            <label>Select Advertistements</label>
            <div class="label-content">
                <sf-list-selector sf-dynamic-items-selector
                                  sf-multiselect="true"
                                  sf-master="true"
                                  sf-selected-ids="selectedAdvertisementIds"
                                  sf-item-type="properties.AdvertisementType.PropertyValue"
                                  sf-identifier-field="Title">
                </sf-list-selector>
            </div>
        </div>
    </uib-tab>
</uib-tabset>

selectedAdvertisementIds is not set by the directive. if you remove the tab/tabset, it will works as expected.

As a workaround in the associated angular controller:

$scope.itemSelector = { selectedItemsIds: [] };

$scope.$watch(
                "itemSelector.selectedAdvertisementIds",
                function(newValue, oldValue) {
                    if (newValue !== oldValue) {
                        $scope.properties.SelectedAdvertisementIds.PropertyValue = JSON.stringify(newValue);
                    }
                },
                true
            );

@ghost
Copy link

ghost commented Jul 23, 2016

I ran into this last week, and has reported it as a bug. It is confirmed as a bug by Telerik Support.

@vesrah
Copy link

vesrah commented Jun 21, 2017

This (sf-link-selector / link selector) is also broken inside of expanders.

@NikolayBa
Copy link

@harryluo91
Copy link

@NikolayBa I ran into this problem and was able to work around it with the proxy method described in your link. However it seems to have a race condition when I am trying to set an initial value for the selector. I added a watch to the scope.selectedItem and it will often reset the value back to the default empty one after setting it correctly initially when the propertyService.get() was called. Do you have any ideas why is this happening?
Note: I have several sf-link-selector in a uib-tabset with multiple tabs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants