searchable-option-list icon indicating copy to clipboard operation
searchable-option-list copied to clipboard

Dynamic binding to SOL, based on multiple selection

Open tapan8 opened this issue 8 years ago • 0 comments

Hi,

How can we dynamically bind SOL while getting the parameters values from the another SOL.

Which event should be called and where in jscript, while performing the ajax call?

Can we retain the selected values in the second SOL while appending/refreshing the SOL.

example: Need to bind the first SOL with Course and then bind the second SOL with subjects for the selected courses.

@Html.DropDownList("my-select", (IEnumerable)ViewBag.CourseList, htmlAttributes: new { multiple = "multiple" })
Refresh

SOL.js // Refered https://github.com/pbauerochse/searchable-option-list/issues/51 $.fn.searchableOptionList = function (options) { var result = []; this.each(function () { var $this = $(this), $alreadyInitializedSol = $this.data(SearchableOptionList.prototype.DATA_KEY); if ($alreadyInitializedSol) { //result.push($alreadyInitializedSol); $alreadyInitializedSol.$container.html(''); var newSol = new SearchableOptionList($this, options);
result.push(newSol);
setTimeout(function () { newSol.init(); }, 0); } else { var newSol = new SearchableOptionList($this, options); result.push(newSol);

            setTimeout(function() {
                newSol.init();
            }, 0);
        }
    });

    if (result.length === 1) {
        return result[0];
    }

    return result;
};

Thanks Tapan [email protected]

tapan8 avatar Oct 25 '17 12:10 tapan8