The value of the select is edit and the datatable take the first value of the select
The value of the select is edit and the datatable take the first value of the select
rshun
Posts: 44Questions: 9Answers: 0
Hi,
MV is a checkbox field, Unit is select dropdown field. When MV change, it sends
{"Unit":"ABC","MV":1} to server.
It seems editor post first value of select even if id does not change.
https://datatables.net/forums/discussion/comment/132492/#Comment_132492
I try .edit($(this).closest("td"), false, { submit: 'changed' } ) to try to stop sending Unit. It still does not working.
Please help me.
Rick
This discussion has been closed.
Replies
Is it possible to remove "Unit"
in
editor
.edit($(this).closest('tr'), false, { submit: 'changed' })
.set('MV', $(this).prop('checked') ? 1 : 0)
.submit();
?
I try to remove Unit before submit it back server
I got javascript error: Uncaught Unknown field name - Unit
I need a way to check Unit in changes or not.
Please help me.
Hi rshun,
Can you give me a link to your page showing the issue so I can take a look and help to debug this please?
Thanks,
Allan
That is internal website.
I try
I got javascript error: Uncaught Unknown field name - Unit
Anyway, I need a way to remove Unit from changes.
I also try
changes.field('Unit').multiRestore();
Is it possible to do single field restore?
Removes the
Unit
field! From theclear()
docs:You perhaps want to use
changes.field('Unit').val('');
here?Allan
Now I got javascript error: Uncaught Unknown field name - MV
I think I need a way to add back MV field.
Rick
I try
I got javascript error: Uncaught TypeError: Cannot read property 'opts' of undefined
at name
How can I put MV field back to changes?
Thanks.
changes.clear()
will remove all fields. I'm not sure why you would want to remove any fields?If you aren't able to give me a link to your page, could you modify this example to demonstrate the issue you are originally seeing, so I can debug it please?
Allan
Unit is a dropdown field. Unit depend on Site. Because editor post first value of select. I don't want to have 'Unit' in my changes.
I figure out that in my MV checkbox change, I can remove Unit before submit. After submit, I add it back. It works.
Before:
{"Unit":"ABC","MV":1}
After:
{"MV":1}
I appreciate you've got a working solution, but it sounds like you're using it as a placeholder value - there is a
placeholder
attribute you can use instead (seeselect
).Colin
Thanks, Colin. I will try placeholder later.