jqGrid cómo agregar múltiples casillas de verificación a una columna
Frecuentes
Visto 2,763 veces
0
I want to add multiple check boxes to a column on edit/add mode. Now this column has a select box with multiple option enabled. I want to replace it with checkbox list or radio button list
My idea is: user should be able to select the relevant options as he desired by checking the check boxes which are listed in a particular cell(on add or edit mode:inline). Once the row is saved should show only the selected option user selected(without check boxes).
Below is my code snippet for the select box for particular column:
{
name: 'RoomTypes', index: 'RoomTypes', width: 300, editable: true, edittype: 'select',
editoptions: {
value: roomTypesFormatterEdit,
custom_element: function (value, options) {
return $.jgrid.createEl.call(this, "select",
$.extend(true, {}, options, { custom_element: null, custom_value: null }),
value);
},
custom_value: function ($elem, operation, value) {
if (operation === "get") {
return $elem.val();
}
},
multiple: true
},
align: 'left', formatter: roomTypesFormatter
},
Where "roomTypesFormatterEdit" return list of hotel room names which will display in select box.
Also I want to re-arrange the height of the editing(edit mode) row to fit with the height of the check boxes or to show all the items in the select box
Please Help Thank you all
1 Respuestas
2
I think that you don't need to write your custom editing control (custom_element
y custom_value
) or custom formatter (formatter
y unformat
). Instead of that you need just add multiple: true
propiedad a editoptions
to have base multiselect functionality. To improve visibility you can use some existente controles como Widget jQuery UI MultiSelect or Seleccionar2. La respuesta y esta provide demos which uses jQuery UI MultiSelect Widget. una respuesta mas y esta provide demos which use Select2. The demos don't use multiselect functionality of Select2, but it's just an option of the control (see la documentación).
contestado el 23 de mayo de 17 a las 13:05
No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas javascript jquery checkbox jqgrid or haz tu propia pregunta.
@gamini2006: You are welcome! I'm glad that I could help you. - Oleg