Jump to content
uniGUI Discussion Forums
TI.ME

Filter uniDbGrid runTime

Recommended Posts

Good Morning!!!

I'm creating a Filter option in uniDbGrid in runtime ...

All component connections ...

The visual display is perfect, but the filter code does not work.

When I type the letter no, the event is triggered but the value of the second letter on, the event is not even triggered !!!

I have a project ready but I do not know how to attach in the forum !!!

Could you guide me ???

Unigui Version 1.10.0 Build 1469

 

 

 

Code Customer...

 

 

procedure TMainForm.UniFormCreate(Sender: TObject);
var
  oHidePanel : TUniHiddenPanel;
  oEdit : array of TUniEdit;
  i : integer;
begin
  TUniHiddenPanel(oHidePanel) := TUniHiddenPanel.Create(Self);
 
  for I := 0 to Pred(UniDBGrid1.Columns.Count) do
  begin
    SetLength(oEdit,Length(oEdit)+1);
    TUniEdit(oEdit)        := TUniEdit.Create(Self);
    TUniEdit(oEdit).Parent := TUniHiddenPanel(oHidePanel).Parent;
    TUniEdit(oEdit).Width  := UniDBGrid1.Columns.Items.Width - 10;
    TUniEdit(oEdit).Name   := 'Edit_'+IntToStr(i);
    UniDBGrid1.Columns.Items.Filtering.Enabled := True;
    UniDBGrid1.Columns.Items.Filtering.Editor  := TUniEdit(oEdit);
  end;
 
  UniMainModule.ADOQuery1.Open;
  UniMainModule.ADOQuery2.Open;
end;

Share this post


Link to post
Share on other sites

 

Good Morning!!!

 

I'm creating a Filter option in uniDbGrid in runtime ...

 

All component connections ...

 

The visual display is perfect, but the filter code does not work.

 

When I type the letter no, the event is triggered but the value of the second letter on, the event is not even triggered !!!

 

I have a project ready but I do not know how to attach in the forum !!!

 

Could you guide me ???

 

Unigui Version 1.10.0 Build 1469

 

 

 

Code Customer...

 

 

procedure TMainForm.UniFormCreate(Sender: TObject);
var
  oHidePanel : TUniHiddenPanel;
  oEdit : array of TUniEdit;
  i : integer;
begin
  TUniHiddenPanel(oHidePanel) := TUniHiddenPanel.Create(Self);
 
  for I := 0 to Pred(UniDBGrid1.Columns.Count) do
  begin
    SetLength(oEdit,Length(oEdit)+1);
    TUniEdit(oEdit)        := TUniEdit.Create(Self);
    TUniEdit(oEdit).Parent := TUniHiddenPanel(oHidePanel).Parent;
    TUniEdit(oEdit).Width  := UniDBGrid1.Columns.Items.Width - 10;
    TUniEdit(oEdit).Name   := 'Edit_'+IntToStr(i);
    UniDBGrid1.Columns.Items.Filtering.Enabled := True;
    UniDBGrid1.Columns.Items.Filtering.Editor  := TUniEdit(oEdit);
  end;
 
  UniMainModule.ADOQuery1.Open;
  UniMainModule.ADOQuery2.Open;
end;

 

 

tente assim:

 

procedure TMainForm.UniFormCreate(Sender: TObject);
var
  oHidePanel : TUniHiddenPanel;
  oEdit : array of TUniEdit;
  i : integer;
begin
  oHidePanel := TUniHiddenPanel.Create(Self);
  oHidePanel.Parent := self;
  self.InsertControl(oHidePanel);
 
  for I := 0 to Pred(UniDBGrid1.Columns.Count) do
  begin
    SetLength(oEdit,Length(oEdit)+1);
    TUniEdit(oEdit)        := TUniEdit.Create(Self);
    TUniEdit(oEdit).Parent := oHidePanel;
    TUniEdit(oEdit).Width  := UniDBGrid1.Columns.Items.Width - 10;
    TUniEdit(oEdit).Name   := 'Edit_'+IntToStr(i);
 
    UniDBGrid1.Columns.Items.Filtering.Enabled := True;
    UniDBGrid1.Columns.Items.Filtering.Editor  := TUniEdit(oEdit);
    UniDBGrid1.Columns.Filtering.ChangeDelay := 250;
  end;
 
  UniMainModule.ADOQuery1.Open;
  UniMainModule.ADOQuery2.Open;
end;

Share this post


Link to post
Share on other sites
On 8/23/2018 at 12:19 PM, Hayri ASLAN said:

We have a solution. After adjust email address we will share it.

Hello!! =]

I'm with this exactly problem, i'm creating the filter in runtime and the visual are ok but the event just trigger once and de variable 'value' comes empty.

Share this post


Link to post
Share on other sites
21 minutes ago, freedowsRoO said:

I'm with this exactly problem, i'm creating the filter in runtime and the visual are ok but the event just trigger once and de variable 'value' comes empty.

Testcase?

Share this post


Link to post
Share on other sites
15 hours ago, freedowsRoO said:

I modified the grid filter demo to show you the problem.

GridFiltering-2.rar

procedure TMainForm.UniFormCreate(Sender: TObject);
Var
  THidenPanel: TUniHiddenPanel;
  TEdit: TUniEdit;
begin
  UniMainModule.ADOQuery1.Open;
  UniMainModule.ADOQuery2.Open;

  THidenPanel:= TUniHiddenPanel.Create(self);
  THidenPanel.Parent := Self;  //<--------------------
  THidenPanel.Name:= 'THiddenPanel';

  TEdit:= TUniEdit.Create(self);
  TEdit.Parent:= THidenPanel;
  TEdit.Name:= 'TEdit';
  TEdit.EmptyText:= 'teste';

  if Assigned(TEdit) then
  begin
    UniDBGrid1.Columns[3].Filtering.Editor:= TEdit;
    UniDBGrid1.Columns[3].Filtering.Enabled:= True;
  end;

end;

 

  • Like 1

Share this post


Link to post
Share on other sites
10 hours ago, Sherzod said:

procedure TMainForm.UniFormCreate(Sender: TObject);
Var
  THidenPanel: TUniHiddenPanel;
  TEdit: TUniEdit;
begin
  UniMainModule.ADOQuery1.Open;
  UniMainModule.ADOQuery2.Open;

  THidenPanel:= TUniHiddenPanel.Create(self);
  THidenPanel.Parent := Self;  //<--------------------
  THidenPanel.Name:= 'THiddenPanel';

  TEdit:= TUniEdit.Create(self);
  TEdit.Parent:= THidenPanel;
  TEdit.Name:= 'TEdit';
  TEdit.EmptyText:= 'teste';

  if Assigned(TEdit) then
  begin
    UniDBGrid1.Columns[3].Filtering.Editor:= TEdit;
    UniDBGrid1.Columns[3].Filtering.Enabled:= True;
  end;

end;

 

It works but when i try to create a grid at runtime it's not work.... anny ideia?

GridFiltering-2.rar

Share this post


Link to post
Share on other sites

Если в примере GridFilter2 на HiddenPanel кинуть TUniTreeView, то будет AccessViolation при загрузке

Share this post


Link to post
Share on other sites

Good evening, could you put an example of how he did it thanks

Share this post


Link to post
Share on other sites

You can use the standard example "GridFiltering-2".

Drop TUniTreeView on UniHiddenPanel1 and press "Run(F9)" with debug. Then open localhost:8077 in browser.

Delphi Rio, UniGUI 1530, Firefox, Win 10 x64.

Screenshot_21.jpg

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×