Commit fe85fbd8 authored by Tejesh's avatar Tejesh 🖖
Browse files

DOC: review updates

parent 2f0eb3d6
Pipeline #66990 passed with stage
in 2 minutes and 9 seconds
......@@ -582,7 +582,6 @@ The full list of options is below. Simple options can be specified as `data-` at
- `input`: **Mandatory**. The type of input element to use. The valid values are checkbox, radio, range, select, and any other legal [HTML form input type](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input).
- `options`: An array of options to select from. **Mandatory** if `input` is either of `select` or `radio`
- `attrs`: To place common attributes such as max, min, placeholder, name etc., on the `input` element.
For dropdown or radio UI elements, `attrs` accepts an object with these attributes as key and value.
Example:
`input: 'number', attrs: {step: 10, placeholder: '0 - 1000', name: 'some_name'}` would render as
......@@ -708,7 +707,7 @@ Features to be implemented:
Note: Make sure `load` event listener is attached before calling `$.formhandler()`
- `editmode` is fired when the Edit button is clicked to edit the table.
- `editmode` is fired on the source when the Edit button is clicked and table changes to edit mode.
### $.formhandler examples
......@@ -808,8 +807,10 @@ In edit mode, show HTML input bindings like Dropdown, Datepicker, Number fields.
}
}
]
}).on('edit', function () {
}).on('editmode', function () {
// turns <select class="select-example-basic">...</select> to select2 dropdown widget
$('.select-example-basic').select2()
// turns <input type="text" class="datepicker-example"/> to bootstrap-datepicker calendar widget
$('.datepicker-example').datepicker({
format: 'dd-mm-yyyy',
todayHighlight: true,
......
......@@ -301,6 +301,7 @@ function editHandler($this, template_data, options, template) {
var data = JSON.parse(edited_row.getAttribute('data-val'))
var rowIndex = edited_row.getAttribute('data-row')
for (key in data) {
// TODO: refactor to identify editable columns other than using data-key attrs on <td> tag
var editable_element = $('td[data-key=' + (remove_quotes(key)) + '] :input', $(edited_row))
if (editable_element.length) {
data[key] = template_data['data'][rowIndex][key] = editable_element.val()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment