can the new "data-editor-value" be used for inline editor ?
can the new "data-editor-value" be used for inline editor ?
I'm reading trough the release notes and i've seen the data-editor-value witch is fantastic ... but i'm not sure if it works for inline editor, on docs it says just standalone editor ... basically i have a HTML generated datatable and some cell values may have a prefix or suffix that should not really be edited with inline editor they are added from CMS and are the same for all columns so i would only need to edit the value that's why when i've seen the data-editor-value i thought this is awesome .. but it seems it does not work ... for inline editor or does it ?
what i've done is added like this
<td data-editor-value="100">100 km</td>
but when i click on field to edit in the input box i get 100 km instead of 100
This question has an accepted answers - jump to answer
Answers
The inline editor works with both table editing and standalone editing, but I'm afraid that the
data-editor-value
option only works with standalone (while it appears you are editing a table).If you want your user to submit an integer only, but to add
km
as a postfix, use a data renderer.Allan
Thank you for your reply!
yes i'm doing inline editing on a HTML generated datatable not JSON, i don't think i can still use data renderer or can i ?
if i can't use data renderer on a HTML generated datatable can i use something like
<td><span>100</span> km</td>
and target from editor td > span not just td ?
or there is a callback that i can use just before that input is generated in the td cell and populated with the cell value, like that i can grab the td value and strip down any postfix/prefix it may have
You can still use
columns.render
on a DOM sourced table. Here is a nonsense example: http://live.datatables.net/qelilowu/1/edit .Allan
Thank you Allan for your example, i had no idea u could do that on HTML generated table, good to know in the future, however this time i took a different approach inspired by the new data-* tag added for standalone editor hope it will help someone, this is the code below
and on td element i simply use data-value="whatever"
now if i think about it i should put it in context here is the code again
Awesome. Thanks for posting back with your code.
Allan