Hello, are you considering adding KTU Select2 support in version 9.3.6?
I'm using an external browser, but I'm having problems with the CSS.
Hi Halil
KTUI Select supports accessing custom data from selected options.
The native HTML title attribute works with KTUI Select, similar to Select2. You can set it on options and access it via JavaScript:
For Static Options:
<select
data-kt-select
data-kt-select-allow-clear="true"
>
<option value="1" title="Additional title data">Option 1</option>
<option value="2" title="Another title">Option 2</option>
</select> function Etkinlik_Genel_IslemDurumuListesi() {
const selectElement = document.getElementById("SLC_EtkinlikIslemDurumuBilgisi");
// Initialize KTUI Select with remote data
const select = KTSelect.getInstance(selectElement) || new KTSelect(selectElement);
// Listen for when options are loaded/updated
selectElement.addEventListener("change", function() {
const selectedOption = this.options[this.selectedIndex];
const title = selectedOption.title || selectedOption.getAttribute("title");
// Use the title data (e.g., update TinyMCE)
if (tinymce.get("TXA_KararBilgisiTanimlamaPencereAlani_AciklamaBilgisi")) {
const currentContent = tinymce.get("TXA_KararBilgisiTanimlamaPencereAlani_AciklamaBilgisi").getContent();
tinymce.get("TXA_KararBilgisiTanimlamaPencereAlani_AciklamaBilgisi")
.setContent(currentContent + title);
}
});
// If using remote data, you may need to set title attributes after data loads
// This can be done via a custom event listener or by modifying the remote data handler
} Hi Halil İbrahim AYHAN,
Could you please give more detailed requirements or a reference from select2 for this feature? We will consider adding it for KTUI Select.
Thanks
Hi,
Currently, with Select2, I'm returning additional fields called color and title from the Controller.
function Etkinlik_Genel_IslemDurumuListesi() {
$("#SLC_EtkinlikIslemDurumuBilgisi").select2({
allowClear: true,
ajax: {
url: "/Etkinlik/Genel/IslemDurumuListesi_Alan2",
type: "GET",
delay: 250,
data: function (Deger) {
return {
AramaBilgisi: Deger.term
};
},
processResults: function (GelenVeri) {
return {
results: GelenVeri
};
}
},
templateResult: SelectOption_GenelBicimlendirme
});
}
function SelectOption_GenelBicimlendirme(Nesne) {
if (!Nesne.id) {
return Nesne.text;
}
var $Sonuc = $("<span >" + Nesne.text + "</span>");
return $Sonuc;
} tinymce.get("TXA_KararBilgisiTanimlamaPencereAlani_AciklamaBilgisi").setContent(tinymce.get("TXA_KararBilgisiTanimlamaPencereAlani_AciklamaBilgisi").getContent() + $("#SLC_KararBilgisiTanimlamaPencereAlani_AciklamaBilgisi option:selected")[0].title); I can perform data transfer using the title in Select2, but this feature is not available in KTUI Select.
Hi,
Metronic 9.x uses KTUI Select instead of Select2:
https://ktui.io/docs/select
Regards,
Sean