6
Answers

How can I return date in Edit form?

BKS Saha

BKS Saha

7y
188
1
{"data": "Date","render":function(data) {
return moment(data).format("L");
},
"name": "Date",
"auto Width":true
}
for edit
var Date = moment(data[i].Date).format("L");
Answers (6)
0
Amit Kumar

Amit Kumar

NA 3.5k 203.6k 7y
Hi, When you click on edit button bind the value of those element in you model property using jquery after that you can use Ajax method then you will get this values.
0
Ramesh Palanivel

Ramesh Palanivel

NA 9.5k 138.6k 7y
Hi BKS,
 
What is the value you are getting in this field - data[i].Date
0
BKS Saha

BKS Saha

NA 32 804 7y
Dear Ramesh Palanivel,
 
I have tried your code but same problem.Now i am sharing my code
 
create
{
"data": "Date",
"render":function(data) {
return moment(data).format("MM/DD/YYYY");
},
"name": "Date", "autoWidth": true
},
Edit
for (i = 0; i < data.length; i++) {
var Name = data[i].Name;
var Code = data[i].Code;
var Email =data[i].Email;
var Date = $('#Date-Id').val(moment(data[i].Date).format('MM/DD/YYYY'));
$('#Name-Id').val(Name);
$('#Code-Id').val(Code);
$('#Email-Id').val(Email);
$('#Date-Id').val(Date);
}
0
Ramesh Palanivel

Ramesh Palanivel

NA 9.5k 138.6k 7y
Hi Saha,
 
 Try this code,
 
$('#dpEffective').val(moment(data[i].Date).format('MM/DD/YYYY')); 
0
BKS Saha

BKS Saha

NA 32 804 7y

Attachment Capture.rar

Hi Ramesh Palanivel,
Thank you, for creating ui it is working fine, for edit ui i need similar date what i put in create.
0
Ramesh Palanivel

Ramesh Palanivel

NA 9.5k 138.6k 7y
Hi Saha,
 
What's your exact requirement. Please share some screen shots.