Insertar control chosen (harvesthq) en mi datatable
Insertar control chosen (harvesthq) en mi datatable
kennyesquivelt
Posts: 1Questions: 1Answers: 0
Tengo el siguiente codigo cuando construyo mi datatable:
"columns": [
{ "data": "Id_Soli" },
{ "data": "Fe_Soli_Vw" },
{ "data": "Hr_Soli_Vw" },
{
data: null,
render: function (data, type, row) {
var $select = $('<select id="Id_Clie[]" name="Id_Clie[]" class="form-control chosen-single form-control-sm"></select>');
$.each(elementosClieInt.d.dataCliente, function (index, val) {
var $option = $("<option></option>", {
text: val.No_RazonSoci,
value: val.Id_Clie
});
if (row.Id_Clie === val.Id_Clie) {
$option.attr("selected", "selected");
}
$select.append($option);
});
return $select.prop("outerHTML");
}
},
{ "data": "De_Exam" }
],
El select se esta creando normal cargando los datos y seleccionando el dato que esta en la BD, pero el problema es que desconozco donde puedo darle la funcion chosen para activar el plugin, ya que si bien se le asigna dicha clase pero falta activarlo.
Edited by Colin - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.
Answers
We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.
Cheers,
Colin