Hey, I found some others issues on the code from jToast.
There is what I changed (in uniJToast > BuildJsonParams):
allowToastClose
if allowToastClose then
bstr := bstr + 'allowToastClose:true,'
else
bstr := bstr + 'allowToastClose:false,';
stack
if (stack) then
bstr := bstr + 'stack:' + IntToStr(stackSize) +','
else
bstr := bstr + 'stack:false,';
position
bstr := bstr + 'position:' + '"' + StringReplace(GetPosition(pos), '_', '-', [rfReplaceAll]) + '",';
loader (like Pep's post)
if loader then begin
bstr := bstr + 'loader:true,';
bstr := bstr + 'loaderBg: ' + '"' + loaderBg + '",';
end else
bstr := bstr + 'loader:false,';
With these changes the component worked perfectly.
Here is all procedure code:
function TUniJToast.BuildJsonParams: string;
var bstr: string;
begin
bstr := '{';
bstr := bstr + 'text:' + '"' + text + '",';
bstr := bstr + 'heading:' + '"' + heading + '",';
bstr := bstr + 'icon:' + '"' + GetIconType(icon) + '",';
bstr := bstr + 'showHideTransition:' + '"' + GetTransition(showHideTransition) + '",';
if allowToastClose then
bstr := bstr + 'allowToastClose:true,'
else
bstr := bstr + 'allowToastClose:false,';
if hideAfter > 0 then
bstr := bstr + 'hideAfter:' + IntToStr(hideAfter) + ',';
if (stack) then
bstr := bstr + 'stack:' + IntToStr(stackSize) +','
else
bstr := bstr + 'stack:false,';
bstr := bstr + 'position:' + '"' + StringReplace(GetPosition(pos), '_', '-', [rfReplaceAll]) + '",';
bstr := bstr + 'textAlign:' + '"' + GetTextAlign(textAlign) + '",';
if loader then begin
bstr := bstr + 'loader:true,';
bstr := bstr + 'loaderBg: ' + '"' + loaderBg + '",';
end else
bstr := bstr + 'loader:false,';
// Add Callbacks here
bstr := bstr + 'beforeShow: function() { ajaxRequest('+JSName+',"beforeShow",[]); },';
bstr := bstr + 'afterShown: function() { ajaxRequest('+JSName+',"afterShown",[]); },';
bstr := bstr + 'beforeHide: function() { ajaxRequest('+JSName+',"beforeHide",[]); },';
bstr := bstr + 'afterHidden: function() { ajaxRequest('+JSName+',"afterHidden",[]); }';
bstr := bstr + '}';
result := bstr;
end;