Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Paul Sørensen 304 posts 650 karma points
    Jan 28, 2017 @ 17:41
    Paul Sørensen
    0

    datetimepicker databinding problem

    Hi

    I have created a Datetimepicker and I have problems getting my values back from the controller

    My markup is

    <div class="umb-editor umb-datepicker" ng-controller= "Caddie.DatepickerController" id="matchDate">    
       <div class="input-append date datepicker" style="position: relative;">
             <input name="matchDate" data-format="DD-MM-YYYY" type="text" ng-model="match.matchDate" />
             <span class="add-on">
                 <i data-date-icon="icon-calendar"></i>
             </span>    
      </div> 
    </div>
    

    and I have this in my controller

    function applyDate(e) {
        angularHelper.safeApply($scope, function () {
            // when a date is changed, update the model
            var elementData = $element.find("div:first").data().DateTimePicker;
            if (e.localDate) {
               $scope.dateValue = e.localDate.toString("YYYY-MM-DD");
            }
            console.log($scope.dateValue)
            elementData.setValue($scope.dateValue);
        });
    }
    

    When the value is changed using the popup my match.matchDate isn't changed, but when I change the value manually it is changed

    Any hints?

    /Paul S

  • Paul Sørensen 304 posts 650 karma points
    Jan 29, 2017 @ 12:51
    Paul Sørensen
    100

    Hi Changed it to use the simpledatepicker and now it works

    https://gist.github.com/jamiepollock/ad1d1be07453cd1d7509

    <div class="control-group umb-control-group">
        <div class="umb-el-wrap">
             <label class="control-label">Dato</label>
             <div class="controls controls-row">
                <simpledatepicker field="match.matchDate" dateformat = "DD-MM-YYYY" />
            </div>
         </div>
    </div>
    

    /Paul S

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies