Hello, in the past, if selecting a DataTable column type as "Date" it would auto populate with today's date. It doesn't seem to do that now. How do I get Today's date (MM/DD/YYYY) populating when a new record is added to the table?
The code that I've been using for my table is this:
fd.rendered(() => {
fd.control('DataTable1').widget.bind('beforeEdit', function(e) {
var model = e.model;
if (model.isNew()) {
model.set('DateColumn', new Date());
}
});
});
@IliaLazarevskii your code got the date column to auto populate again, but now I cannot access the dropdown for the 'Assessment' column. The screen must be refreshed to get it working. Video attached ...thoughts?
So far it seems like the problem is that changing the control value in the beforeEdit event triggers the change event, which unfocuses the control. Double-clicking should help as a temporary workaround.
fd.spRendered(function() {
fd.control('DataTable4').$on('edit', function(e) {
var username = _spPageContextInfo.userDisplayName;
var model = e.model;
model.set('Column3', username);
});
fd.control('DataTable4').widget.bind('beforeEdit', function(e) {
var model = e.model;
if (model.isNew() && !model.get('Column2')) {
model.set('Column2', new Date());
}
});
});