Announcement

Collapse
No announcement yet.

createField

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • createField

    Hi, I'm trying to create a date field that is not in the entityDefs for a sidepanel, I'm using:

    PHP Code:
    this.createField('exportDate'nullnull'Fields.DatetimeShort'); 
    and:

    PHP Code:
    createField: function (nametypeparamsview) {            
                
    type type || this.model.getFieldType(name) || 'base';        
                
    this.createView(nameview || this.getFieldManager().getViewName(type), {
                    
    modelthis.model,
                    
    defs: {
                        
    namename,
                        
    paramsparams || {}
                    },
                    
    elthis.options.el ' .cell-' name,
                    
    mode'list'
                
    });
                
            }, 
    But I'm always getting a 'None' result, what I'm missing?

    Thanks

  • #2
    What value is in model's exportDate attribute. console.log(model.get('exportDate')). Is it defined?

    Comment


    • #3
      No, it seems that it's not defined, I get side.js error.

      Comment


      • #4
        You get None because field is not set?

        Comment


        • #5
          You are correct, I added to my json:

          PHP Code:
          "exportDate": {
                      
          "type""datetime",
                      
          "required"false,
                      
          "notStorable"true,
                      
          "db"false
                  

          and call with:
          PHP Code:
          this.createField('exportDate'false); 
          It's possible to force the field into "Edit Mode", I have to click the pencil everytime I need to edit it.

          Thank you for your help.

          Comment


          • #6
            Something strange happens with the date:

            For example I set the date to: 08.10.2014 17:00

            When I log the date I got: 2014-10-08 15:00:00

            For some reason I get 2 hours less when I log it, I assume that has something to do with my timezone.

            Comment


            • #7
              Date is stored in system format and UTC Timezone, and converted for view using DateTime class and moment lib.

              Comment


              • #8
                It's possible to force the field into edit mode instead of clicking on the pencil everytime?

                Thanks

                Comment


                • #9
                  mode: 'edit'

                  Comment

                  Working...
                  X