As I get in a field the data from another field inside the editor
As I get in a field the data from another field inside the editor
![klermann](https://datatables.net/forums/uploads/userpics/676/n2EOW7KGCPBKT.jpg)
Hello Allan as I get in a field the data from another field inside the editor. I need to retrieve information that comes from the bank in another field so that the user does not edit this information! Look:
fields: [
{ name: "dataDespesa" },
{ name: "dataDespesa2"}
]
I want to retrieve in field dateDespesa2 of hidden type the data of the field dataDespesa
This question has accepted answers - jump to:
This discussion has been closed.
Answers
"on open" or whatever is the suitable event for you.
You probably had this text translated with Google. I guess from Portuguese. Unfortunately Google isn't very good at that. I would try this:
https://www.deepl.com/translator
Much better!
Now the date value in the table is not updated ... but the example is what I need!
not sure whether I understand what you mean ... if you want to keep having updates of the field whenever the user does something you would need to use "dependent". Like this:
The first example I suggested serves, fits, I will use very well. But when I click to update and send the data, in the table (in the list) the field that edits is not updated, the cell that has the data that I update continues with the same information!
that sounds like a different problem and I suggest you post your entire code. Front end and server side. Otherwise I don't see a chance to figure this out.
Look:
Sorry, I cannot read it that way without using Markdown. But maybe somebody else can find the error?
That's a whole lot of code! But I don't see @rf1234's suggestion of
dependent()
anywhere in it. That is exactly what I would suggest as well.Also, I've formatted your code using Markdown now. Details on how to highlight code using markdown can be found in this guide. It would be useful if you could use that please.
Allan
I just follow the recommended to format the code, and every time I publish the code comes out distorted, I am unable to do anything for formatting since I have only this way to format.
Code
The "recommended" is to format the code using Markdown.
A link is provided for your convenience.
Hi klermann,
to be honest I have no idea what is wrong with your code. I'd take a look at what you really send to the server. If the update isn't in those data you know it's a front end problem. Otherwise you can try to debug the back end ...
Sorry for not being able to help more ...
Regarding the code formatting. All I do is copy and paste those three backticks that you find below. I put them before and after my code. That's usually good enough ...
Hi rf1234,
solved here, thanks for help!
Hello rf1234, I once asked myself a question about the same question. As I have a checkbox inside the datatable that does not have the same behavior as the Editor to populate the values, how do I solve this problem by clicking on the checkbox set the values in hidden fields?
Just take a look at „dependent“. I posted a code example above. You can set the value of the hidden field dependent on the user clicking the checkbox.
But what worked right here for me was this example:
not the dependent;
Even using the example, it does not show the value in the console nor does it arrow the value in the data output!
editor.dependent("pagamento", function (val) {
console.log(val);
editor.field("adicPagamento").set(val);
Happy to take a look at a test page showing the issue.
Allan
Follow Allan.
pass: admin
login: admin@admin.com
/ec2-52-21-31-80.compute-1.amazonaws.com:8080/financeiro/despesas/
I get an error when attempting to login there:
Allan
login: admin@admin.com
pass: admin
It looks like it is a custom field type:
Your plug-in would need to trigger the
change
event on the input element when theset
function is triggered.Btw in your
spinner
plug-in you have:That
id
should be avoided since it would mean you can't use that field type more than once on the page (otherwise you would have elements with duplicate ids).Allan