I have used bootstrap 3.3.6 / angular 1.5.8 / ui-bootstrap-tpls 2.1.3 / angular-xeditable - 0.3.0
I am trying to have a editable table (on each row). Everything work fine except date field.
It will show date correctly in display mode but by clicking on Edit --> the issue is it will show an empty date picker.
Could you please help? Below is the part of code in html page
`
tl.logDate which is date field for one of the row has correct value as xeditable will show it correctly in the table in display mode. I think the same issue as #526
Do you see any errors in the console?
Can you provide the code that populates tl.logDate?
Also, what happens if you remove e-datepicker-options? Currently if you want to set minDate and showWeeks it would be with e-min-date and e-show-weeks.
Thanks for your answer Cosloski,
1- No error in console as you can see in screenshot attached. and as you can see in display mode it has value.
2- here is the code that I populate tl. This is a SharePoint app that I am writing with Angular so the service layer is a SharePoint REST call which fetch data and show them in JSON format
$.when(SharePointJSOMService.getAllTimelogsByREST($scope, TimeLogListName,timesheetID))
.done(function(jsonObject) {
console.log('in ctrl when SharePointJSOMService.getAllTimelogsByREST');
angular.forEach(jsonObject.d.results, function(tl) {
$scope.timesheet.timelogs.push({
TLID: tl.Id,
title: tl.Title,
logDate: tl.TSLogDate,
startTime: tl.TSStartTime,
finishTime: tl.TSFinishTime,
logBreaks: tl.TSLogBreak,
subTotalMinutes: tl.TSLogSubtotalMinutes
//totalHours: convertMinuteToHour(tl.TSTotalMinute)
});
});
//$scope is not updating so force with this command
if (!$scope.$$phase) {
$scope.$apply();
}
console.log("time logs count is = "+$scope.timesheet.timelogs.length);
})
.fail(function(err) {
console.info(JSON.stringify(err));
});
3- nothing happen by adding/removing e-datepicker-options.
Thanks
@ehsan-hakimi Since you are using Sharepoint, would you be able to answer this question #497?
I know it's an older question, but since you are using Sharepoint, maybe a comment from you would help other users.
It is there. As you can see in above controller code
angular.forEach(jsonObject.d.results, function(tl) {d.result object (which is JSON result from a call to DB) put in tl
and 4 line below it, it will populate date field using below statement
logDate: tl.TSLogDate,
then populated object (including logDate field and other fields) push in timelogs array in scope as below
$scope.timesheet.timelogs.push({
Also in html (which I didn't mention its entire code), I will get $scope.timesheet.timelogs and using
<tr ng-repeat="tl in timelogs"> I will make a table of rows. I show each row of timelogs as a tl .
That is the reason which {{tl.logDate| date : "yyyy/MM/dd": "+1000"}} (mentioned in my first comment code) will show logDate correctly in display mode because tl.logDate has value. But as soon as I press edit in any row which this code will be run
<span e-form="timeLogForm" editable-bsdate="tl.logDate" e-ng-model="tl.logDate" > then it will show empty as a value of date (which is the case of issue here)
Thanks a lot Ckosloski,
adding new Date(tl.logDate) to the controller while populating data fix my issue. tl.logDate was a C# date field so I was able to work with that but not a JS date field. Sorry for my mistake and appreciate for your time.
Best regards,
As a suggestion, I have added this change to my code. You can apply it into the css of the module. In table row in edit mode, it will increase row vertical space. I checked and find out that it is due to this line code in CSS
I have used bootstrap 3.3.6 / angular 1.5.8 / ui-bootstrap-tpls 2.1.3 / angular-xeditable - 0.3.0 I am trying to have a editable table (on each row). Everything work fine except date field. It will show date correctly in display mode but by clicking on Edit --> the issue is it will show an empty date picker. Could you please help? Below is the part of code in html page `
and here is the part of code in controller
tl.logDate which is date field for one of the row has correct value as xeditable will show it correctly in the table in display mode. I think the same issue as #526
Do you see any errors in the console? Can you provide the code that populates tl.logDate? Also, what happens if you remove e-datepicker-options? Currently if you want to set minDate and showWeeks it would be with e-min-date and e-show-weeks.
Thanks for your answer Cosloski, 1- No error in console as you can see in screenshot attached. and as you can see in display mode it has value. 2- here is the code that I populate tl. This is a SharePoint app that I am writing with Angular so the service layer is a SharePoint REST call which fetch data and show them in JSON format
3- nothing happen by adding/removing e-datepicker-options. Thanks
I am expecting something like this, but I don't see it
tl.logDate = new Date(tl.logDate);
@ehsan-hakimi Since you are using Sharepoint, would you be able to answer this question #497? I know it's an older question, but since you are using Sharepoint, maybe a comment from you would help other users.
It is there. As you can see in above controller code
angular.forEach(jsonObject.d.results, function(tl) {
d.result object (which is JSON result from a call to DB) put in tl and 4 line below it, it will populate date field using below statementlogDate: tl.TSLogDate,
then populated object (including logDate field and other fields) push in timelogs array in scope as below$scope.timesheet.timelogs.push({
Also in html (which I didn't mention its entire code), I will get $scope.timesheet.timelogs and using
<tr ng-repeat="tl in timelogs">
I will make a table of rows. I show each row of timelogs as a tl . That is the reason which{{tl.logDate| date : "yyyy/MM/dd": "+1000"}}
(mentioned in my first comment code) will show logDate correctly in display mode because tl.logDate has value. But as soon as I press edit in any row which this code will be run<span e-form="timeLogForm" editable-bsdate="tl.logDate" e-ng-model="tl.logDate" >
then it will show empty as a value of date (which is the case of issue here)@ehsan-hakimi Is tl.LogDate a JavaScript Date Object like I posted above
new Date(tl.logDate)
?The filter which prints the date will format date strings, they don't have to be a JS Date Object.
If you look at the documentation for the uib-datepicker:
Thanks a lot Ckosloski, adding
new Date(tl.logDate)
to the controller while populating data fix my issue. tl.logDate was a C# date field so I was able to work with that but not a JS date field. Sorry for my mistake and appreciate for your time. Best regards,Please close this.
As a suggestion, I have added this change to my code. You can apply it into the css of the module. In table row in edit mode, it will increase row vertical space. I checked and find out that it is due to this line code in CSS
indeed if you change it to be
then it work better. It won't increase space in edit mode unless there is a validation message that should be appear there. Best regards,
The CSS fix is already done and will be in the next release. You need to close this issue.
Thanks so much