Answer the question
In order to leave comments, you need to log in
How to pass parameter to Select2 Ajax by Kartik?
Hello! I have a table with products and Select2 from a card with product loading. Tired of entering the name of the product every time. Is it possible and how to pass the product id parameter by highlighting the (string) string in select2. So that he immediately selects the product. js gets the post id from the row that the item is selected. How to transfer?
Answer the question
In order to leave comments, you need to log in
Tired of entering the name of the product every time
pluginEvents = [
"change" => "function() { log('change'); }",
"select2:opening" => "function() { log('select2:opening'); }",
"select2:open" => "function() { log('open'); }",
"select2:closing" => "function() { log('close'); }",
"select2:close" => "function() { log('close'); }",
"select2:selecting" => "function() { log('selecting'); }",
"select2:select" => "function() { log('select'); }",
"select2:unselecting" => "function() { log('unselecting'); }",
"select2:unselect" => "function() { log('unselect'); }"
];
$('#mySelect2').on('select2:select', function (e) {
var data = e.params.data;
console.log(data);
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question