Jump to content

TUniDateTimePicker error JSCALL


Canestraro

Recommended Posts

3 hours ago, Canestraro said:

I'm trying to pass this command but it returns the error when running, there is another way to send the css to TUniDateTimePicker?

TUniDateTimePicker( vrComponent ).JSInterface.JSCall( 'addCls' , ['inputWithIcon inputIconBg']);

Hello,

At what point do you execute this code?

Provide your CSS completely.

Link to comment
Share on other sites

Follows CSS and error that appears


.inputWithIcon input[type="text"] {
  padding-left: 40px ;
}

.inputWithIcon {
  position: relative ;
}

.inputWithIcon i {
    position: absolute;
    left: 0px;
    top: 0px;
    padding: 4.2px 4px;
    *: ;
    vertical-align: middle;
    width: 27px;
    /* height: 40px; */
    color: #aaa;
}


.inputWithIcon.inputIconBg i {
    background-color: #fff;
    color: #b47e7e;
    padding: 4px 4px;
    width: 20px;
    height: 22px;
    border-radius: 4px 0 0 4px;
    border-left: 1px solid #9d9d9dd1;
    border-top: 1px solid #9d9d9dd1;
    border-bottom: 1px solid #9d9d9dd1;
    border-right: 0px solid #9d9d9dd1;
    z-index: 1000;
}

 

image.png.14018b1ed750b86b415c8fed9823677c.png

Link to comment
Share on other sites

image.png.dd94f91e1e3b2ab6b57646dbb917b54c.png

 

procedure TfraBaseCad.CarregarTamanho(vpClass : TClass);
  var
  _ctx    : TRttiContext;
  _typ    : TRttiType;
  _pro    : TRttiProperty;
  oAtt    : TCustomAttribute;
  vrComponent : TComponent;
begin
  try
    _ctx := TRttiContext.Create;
    _typ := _ctx.GetType(vpClass);
    for _pro in _typ.GetProperties do begin
      for oAtt in _pro.GetAttributes do begin
        if oAtt is Column then begin
          vrComponent :=FindComponent('ed'+ _pro.Name);
          if vrComponent = nil then
            vrComponent := FindComponent('mm'+ _pro.Name);
            if vrComponent = nil then
              vrComponent := FindComponent('arq'+ _pro.Name);
              if vrComponent = nil then
                vrComponent := FindComponent('cb'+ _pro.Name);
                if vrComponent = nil then
                  vrComponent := FindComponent('dt'+ _pro.Name);

          if vrComponent <> nil then begin
            if (vrComponent is TUniarqedit) then begin
              (vrComponent as TUniarqedit).MaxLength := 100;
            end else if (vrComponent is TUniArqComboBox) then begin
              (vrComponent as TUniArqComboBox).MaxLength := Column(oAtt).Tamanho;
            end else if (vrComponent is TUniedit) then begin
              (vrComponent as TUniEdit).MaxLength := Column(oAtt).Tamanho;
            end else if (vrComponent is TUniComboBox) then begin
              (vrComponent as TUniComboBox).MaxLength := Column(oAtt).Tamanho;
            end else if (vrComponent is TUniNumberEdit) then begin
              (vrComponent as TUniNumberEdit).MaxLength := Column(oAtt).Tamanho;
            end;

            if (Column(oAtt).Required) then begin //(Column(oAtt).Filtered) or (Column(oAtt).Required)  then begin
              if (vrComponent is TUniArqFind) then begin
                (vrComponent as TUniArqFind).Hint := Column(oAtt).Campo;
              end else if (vrComponent is TUniArqEdit) then begin
                (vrComponent as TUniArqEdit).Hint := Column(oAtt).Campo;
              end else if (vrComponent is TUniArqComboBox) then begin
                (vrComponent as TUniArqComboBox).Hint := Column(oAtt).Campo;
              end else if (vrComponent is TUniComboBox) then begin
                (vrComponent as TUniComboBox).Hint := Column(oAtt).Campo;
              end else if (vrComponent is TUniedit) then begin
                (vrComponent as TUniEdit).Hint := Column(oAtt).Campo;
              end else if (vrComponent is TUniComboBox) then begin
                (vrComponent as TUniComboBox).Hint := Column(oAtt).Campo;
              end else if (vrComponent is TUniNumberEdit) then begin
                (vrComponent as TUniNumberEdit).Hint := Column(oAtt).Campo;
              end else if (vrComponent is TUniDateTimePicker) then begin
                (vrComponent as TUniDateTimePicker).Hint := Column(oAtt).Campo;
              end else if (vrComponent is TUniSpinEdit) then begin
                (vrComponent as TUniSpinEdit).Hint := Column(oAtt).Campo;
              end ;
            end;

            if Column(oAtt).Required = true then begin
              if (vrComponent is TUniArqFind) then begin
                TUniArqFind( vrComponent ).ClientEvents.UniEvents.Values['beforeInit'] := 'function (sender, config) {config.cls="inputWithIconObrig inputIconBgObrig"}';
                TUniArqFind( vrComponent ).JSInterface.JSCall( 'addCls' , ['inputWithIcon inputIconBg']);
                TUniArqFind( vrComponent ).FieldLabel          := '<i class="fas fa-exclamation-circle"></i>';
                TUniArqFind( vrComponent).FieldLabelWidth      := 15;
                TUniArqFind( vrComponent ).FieldLabelSeparator := '';
                TUniArqFind( vrComponent ).FieldLabelAlign     := laLeft;
              end else if (vrComponent is TUniArqEdit) then begin
                TUniArqEdit( vrComponent ).ClientEvents.UniEvents.Values['beforeInit'] := 'function (sender, config) {config.cls="inputWithIconObrig inputIconBgObrig"}';
                TUniArqEdit( vrComponent ).JSInterface.JSCall( 'addCls' , ['inputWithIcon inputIconBg']);
                TUniArqEdit( vrComponent ).FieldLabel          := '<i class="fas fa-exclamation-circle"></i>';
                TUniArqEdit( vrComponent).FieldLabelWidth      := 15;
                TUniArqEdit( vrComponent ).FieldLabelSeparator := '';
                TUniArqEdit( vrComponent ).FieldLabelAlign     := laLeft;
              end else if (vrComponent is TUniArqComboBox) then begin
                TUniArqComboBox( vrComponent ).ClientEvents.UniEvents.Values['beforeInit'] := 'function (sender, config) {config.cls="inputWithIconObrig inputIconBgObrig"}';
                TUniArqComboBox( vrComponent ).JSInterface.JSCall( 'addCls' , ['inputWithIcon inputIconBg']);
                TUniArqComboBox( vrComponent ).FieldLabel          := '<i class="fas fa-exclamation-circle"></i>';
                TUniArqComboBox( vrComponent).FieldLabelWidth      := 15;
                TUniArqComboBox( vrComponent ).FieldLabelSeparator := '';
                TUniArqComboBox( vrComponent ).FieldLabelAlign     := laLeft;
              end else if (vrComponent is TUniedit) then begin
                TUniEdit( vrComponent ).ClientEvents.UniEvents.Values['beforeInit'] := 'function (sender, config) {config.cls="inputWithIconObrig inputIconBgObrig"}';
                TUniEdit( vrComponent ).JSInterface.JSCall( 'addCls' , ['inputWithIcon inputIconBg']);
                TUniEdit( vrComponent ).FieldLabel          := '<i class="fas fa-exclamation-circle"></i>';
                TUniEdit( vrComponent).FieldLabelWidth      := 15;
                TUniEdit( vrComponent ).FieldLabelSeparator := '';
                TUniEdit( vrComponent ).FieldLabelAlign     := laLeft;
              end else if (vrComponent is TUniComboBox) then begin
                TUniComboBox( vrComponent ).ClientEvents.UniEvents.Values['beforeInit'] := 'function (sender, config) {config.cls="inputWithIconObrig inputIconBgObrig"}';
                TUniComboBox( vrComponent ).JSInterface.JSCall( 'addCls' , ['inputWithIcon inputIconBg']);
                TUniComboBox( vrComponent ).FieldLabel          := '<i class="fas fa-exclamation-circle"></i>';
                TUniComboBox( vrComponent).FieldLabelWidth      := 15;
                TUniComboBox( vrComponent ).FieldLabelSeparator := '';
                TUniComboBox( vrComponent ).FieldLabelAlign     := laLeft;
              end else if (vrComponent is TUniNumberEdit) then begin
                TUniNumberEdit( vrComponent ).ClientEvents.UniEvents.Values['beforeInit'] := 'function (sender, config) {config.cls="inputWithIconObrig inputIconBgObrig"}';
                TUniNumberEdit( vrComponent ).JSInterface.JSCall( 'addCls' , ['inputWithIcon inputIconBg']);
                TUniNumberEdit( vrComponent ).FieldLabel          := '<i class="fas fa-exclamation-circle"></i>';
                TUniNumberEdit( vrComponent).FieldLabelWidth      := 15;
                TUniNumberEdit( vrComponent ).FieldLabelSeparator := '';
                TUniNumberEdit( vrComponent ).FieldLabelAlign     := laLeft;
              end else if (vrComponent is TUniSpinEdit) then begin
                TUniSpinEdit( vrComponent ).ClientEvents.UniEvents.Values['beforeInit'] := 'function (sender, config) {config.cls="inputWithIconObrig inputIconBgObrig"}';
                TUniSpinEdit( vrComponent ).JSInterface.JSCall( 'addCls' , ['inputWithIcon inputIconBg']);
                TUniSpinEdit( vrComponent ).FieldLabel          := '<i class="fas fa-exclamation-circle"></i>';
                TUniSpinEdit( vrComponent).FieldLabelWidth      := 15;
                TUniSpinEdit( vrComponent ).FieldLabelSeparator := '';
                TUniSpinEdit( vrComponent ).FieldLabelAlign     := laLeft;
              end else if (vrComponent is TUniDateTimePicker) then begin
                TUniDateTimePicker( vrComponent ).ClientEvents.UniEvents.Values['beforeInit'] := 'function (sender, config) {config.cls="inputWithIconObrig inputIconBgObrig"}';
                //TUniDateTimePicker( vrComponent ).JSInterface.JSCall( 'addCls' , ['inputWithIcon inputIconBg']);
                TUniDateTimePicker( vrComponent ).FieldLabel          := '<i class="fas fa-exclamation-circle"></i>';
                TUniDateTimePicker( vrComponent).FieldLabelWidth      := 15;
                TUniDateTimePicker( vrComponent ).FieldLabelSeparator := '';
                TUniDateTimePicker( vrComponent ).FieldLabelAlign     := laLeft;
              end;
            end;
          end;
        end;
      end;
    end;
  finally
    _ctx.Free;
  end;

 

image.png.be472975eed00d21f7d9ba6d8b5c88fa.png

Link to comment
Share on other sites

  • 4 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...