projects
/
kivitendo-erp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
CustomerVendor: vergessenes run_before ergänzt
[kivitendo-erp.git]
/
SL
/
ClientJS.pm
diff --git
a/SL/ClientJS.pm
b/SL/ClientJS.pm
index
a04702e
..
7eb092c
100644
(file)
--- a/
SL/ClientJS.pm
+++ b/
SL/ClientJS.pm
@@
-14,7
+14,7
@@
use Rose::Object::MakeMethods::Generic
my %supported_methods = (
# ## Non-jQuery methods ##
my %supported_methods = (
# ## Non-jQuery methods ##
- flash => 2, # display_flash(<TARGET>, <ARGS>)
+ flash => 2, #
kivi.
display_flash(<TARGET>, <ARGS>)
# ## jQuery basics ##
# ## jQuery basics ##
@@
-103,6
+103,8
@@
my %supported_methods = (
# ## other stuff ##
redirect_to => 1, # window.location.href = <TARGET>
# ## other stuff ##
redirect_to => 1, # window.location.href = <TARGET>
+
+ reinit_widgets => 0, # kivi.reinit_widgets()
);
sub AUTOLOAD {
);
sub AUTOLOAD {
@@
-168,6
+170,7
@@
sub to_array {
sub render {
my ($self, $controller) = @_;
sub render {
my ($self, $controller) = @_;
+ $self->reinit_widgets if $::request->presenter->need_reinit_widgets;
return $controller->render(\$self->to_json, { type => 'json' });
}
return $controller->render(\$self->to_json, { type => 'json' });
}
@@
-217,12
+220,12
@@
with jQuery
First some JavaScript code:
// In the client generate an AJAX request whose 'success' handler
First some JavaScript code:
// In the client generate an AJAX request whose 'success' handler
- // calls "eval_json_res
ponse
(data)":
+ // calls "eval_json_res
ult
(data)":
var data = {
action: "SomeController/the_action",
id: $('#some_input_field').val()
};
var data = {
action: "SomeController/the_action",
id: $('#some_input_field').val()
};
- $.post("controller.pl", data, eval_json_res
ponse
);
+ $.post("controller.pl", data, eval_json_res
ult
);
Now some Perl code:
Now some Perl code:
@@
-278,7
+281,7
@@
There are three things that need to be done for this to work:
=item 1. The "client_js.js" has to be loaded before the AJAX request is started.
=item 1. The "client_js.js" has to be loaded before the AJAX request is started.
-=item 2. The client code needs to call C<
eval_json_response
()> with the result returned from the server.
+=item 2. The client code needs to call C<
kivi.eval_json_result
()> with the result returned from the server.
=item 3. The server must use this module.
=item 3. The server must use this module.