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

Bootstrap-transfer populates only available column. #13

Open
kheyros opened this issue Sep 14, 2014 · 0 comments
Open

Bootstrap-transfer populates only available column. #13

kheyros opened this issue Sep 14, 2014 · 0 comments

Comments

@kheyros
Copy link

kheyros commented Sep 14, 2014

Bootstrap-transfer doesn't allow to populate available or chosen column accordingly to incoming data. In order to do this, I changed the following lines :

// input: [{value:_, content:_}]
_this.$filter_input.val('');
for (var i in input) {
    var e = input[i];
    _this._remaining_list.push([{value:e.value, content:e.content}, true]);
    _this._target_list.push([{value:e.value, content:e.content}, false]);
}

to :

// input: [{value:_, content:_, selected:_}]
_this.$filter_input.val('');
for (var i in input) {
    var e = input[i];
    if (e.selected === true) {
        _this._remaining_list.push([{value:e.value, content:e.content}, false]);
        _this._target_list.push([{value:e.value, content:e.content}, true]);
    } else if (e.selected === false) {
        _this._remaining_list.push([{value:e.value, content:e.content}, true]);
        _this._target_list.push([{value:e.value, content:e.content}, false]);
    }
}

Then you juste need to provide a third parameter named "selected" for each option. It must be set to true to populate the "chosen" column or false for the "available" one.

Hope this will help.

You did a great job with this plugin, by the way. Thank you.

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

1 participant