Jump to content

Recommended Posts

Posted

Hi, I am trying to add a CheckBox to a Grid PagingBar (all good so far) and now need an Ajax Notification Change Listener - please advise - Thanks in advance.

 

    function pagingBar.afterCreate(sender)
    {
      sender.add([
      {
        xtype: 'tbseparator'
      },
      {
        xtype: "checkboxfield",
        fieldLabel: '',
        labelWidth: "0px",
        inputValue: '0',
        id: "checkboxID",
        width: 20,
        listeners:
        {
          change: function(el, v)
          {
            ajaxRequest(sender, "_checkboxChange", ["val=])
          }
        }
      }
      ]);
    }
 
...
 
procedure TMainForm.UniFormAjaxEvent(Sender: TComponent; EventName: string; Params: TUniStrings);
begin
  if SameText(EventName, '_checkboxChange') = True then begin
    ShowMessage('Hi'); //SHOW CHECKBOX STATE (Checked/UnChecked) HERE
  end;
end;
 
 
Posted

Hi,

 

Try this:

 

1.

...
change: function(el, v) {
    ajaxRequest(sender, "_checkboxChange", ["val=" + v])
}
...

2.

procedure TMainForm.UniDBGrid1AjaxEvent(Sender: TComponent; EventName: string;
  Params: TUniStrings);
var
  _checked: Boolean;
begin
   if SameText(EventName, '_checkboxChange') = True then
   begin
     _checked := StrToBool(Params.Values['val']);
    ShowMessage(BoolToStr(_checked));
  end;
end;

Best regards,

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...