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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...