Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TExtObject.Ajax(string) does not add the Obj parameter #63

Open
GoogleCodeExporter opened this issue Mar 14, 2015 · 0 comments
Open

TExtObject.Ajax(string) does not add the Obj parameter #63

GoogleCodeExporter opened this issue Mar 14, 2015 · 0 comments

Comments

@GoogleCodeExporter
Copy link

This Ajax overload:

function TExtObject.Ajax(MethodName : string; Params : array of const; IsEvent 
: boolean = false) : TExtFunction;

does not add the Obj parameter to the generated JS code, unless IsEvent is True.

It is useful, at times, to call this method on an instance with a computed 
(i.e. not fixed) method name, so I propose that the Obj param is always added:

function TExtObject.Ajax(MethodName : string; Params : array of const; IsEvent 
: boolean = false) : TExtFunction;
var
  lParams : string;
begin
  InJSFunction := false;
  Result  := TExtFunction(Self);
  lParams := IfThen(JSName = '', '', 'Obj=' + JSName);
  if IsEvent then begin
    lParams := lParams + '&IsEvent=1&Evt=' + MethodName;
    MethodName := 'HandleEvent';
  end;
  AjaxCode(MethodName, lParams, Params);
end;

Note: this version also fixes a glitch in which an extra & (resulting in an 
empty param) was being put in the generated code.

Original issue reported on code.google.com by nando.dessena on 11 Aug 2011 at 4:33

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant