Jump to content

Grid PagingBar CheckBox Change Listener AjaxRequest help required


andyhill

Recommended Posts

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;
 
 
Link to comment
Share on other sites

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,

Link to comment
Share on other sites

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