dmzn
-
Posts
2 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Posts posted by dmzn
-
-
//Date: 2021-08-01
//Parm: FEntity.FItems索引
//Desc: 依据nIdx字典项,创建过滤组件
function TBindData.AddFilterCtrl(const nIdx: Integer): TControl;
var nEdit: TUniEdit;
begin
if not Assigned(FFilterPanel) then
begin
FFilterPanel := TUniHiddenPanel.Create(FParentControl);
FFilterPanel.Parent := FDBGrid.Parent;
//this needs to have a parent assigned and coexist with the TUniDBGrid
FFilterPanel.Visible := False;
end;Result := FindFilterCtrl(nIdx);
if Assigned(Result) then Exit;
if not FEntity.FItems[nIdx].FQuery then Exit;nEdit := TUniEdit.Create(FParentControl);
with nEdit do
begin
Parent := FFilterPanel;
CharEOL := #13;
EmptyText := 'search...';Tag := nIdx;
ClearButton := True;
end;Result := nEdit;
end;
How to Get JS function result?
in General
Posted
procedure TfFormFilterHistory.UniButton1Click(Sender: TObject);
var nStr: string;
begin
nStr := 'var t1=%s.getEditorBody().outerText;'+ //1.call function
'ajaxRequest(%s.form, ''getHTMLtext'', [''t1=''+t1]);'; //2.send result to server
nStr := Format(nStr, [Memo1.JSName, self.Name]);
UniSession.SendResponse(nStr);
UniSession.Synchronize; // MainModule.EnableSynchronousOperations=true,here is important
ShowMessageN(FText); //show result
end;
procedure TfFormFilterHistory.UniFormAjaxEvent(Sender: TComponent;
EventName: string; Params: TUniStrings);
begin
if EventName='getHTMLtext' then
begin
FText:=Params.Values['t1']; //3.receive result
end;
end;