Jump to content

Recommended Posts

Posted

I'm creating unidbgrid and it's partially working, I'm not able to set the Filtering.editor property to below the code I'm doing.

 

    Grade.Columns.Clear;
    Grade.Columns.BeginUpdate;
    tmpCons.first;
    while not tmpCons.eof do
    begin
        with Grade do
        begin
            with Columns.Add do
            begin
              FieldName     := tmpCons.fieldbyname('campo').asstring;
              Title.Caption := tmpCons.fieldbyname('titulo').asstring;
              Width         := tmpCons.fieldbyname('tamanho').asinteger;
              Font.Charset  := ANSI_CHARSET;
              Font.Name     := 'Verdana';
              DisplayMemo   := True;
              Sortable      := True;
              if tmpCons.fieldbyname('tipo').asstring = 'TUniEdit' then
              begin
                with TUniEdit.Create(Self) as TUniEdit do
                begin
                   Left   := 10;
                   Top    := 10;
                   Parent := UniHiddenPanel1;
                   Text   := '';
                   Name   := 'Edit'+tmpCons.fieldbyname('campo').asstring;
                end;
                Filtering.Enabled := True;
                Filtering.editor  := TUniEdit(FindComponent('Edit'+tmpCons.fieldbyname('campo').asstring));
              end;
            end;
        end;
        tmpCons.next;
    end;
    Grade.Columns.EndUpdate;
 

 

what am I doing wrong?

 

 

Posted

Hi,

 

Can you remove the filter at run time?

 

It can be added in the next versions..

 

Can you try this approach for now ?!:

type
  TExUniCustomDBGrid = class (TUniCustomDBGrid)

  end;
procedure TMainForm.UniButton1Click(Sender: TObject);
begin
  // clear filters 
  UniDBGrid1ClearFilters(UniDBGrid1);
  
  UniDBGrid1.Columns[1].Filtering.Enabled := False;
  TExUniCustomDBGrid(UniDBGrid1).DoConfigureJSColumns(UniDBGrid1.DataSource.DataSet);
end;

Best regards,

  • 5 months later...
Posted

Hi Delphi Dev, I tried your solution to show/hide the filter at runtime because I was interested in such a feature in the application I'm developing:

 

procedure TMainForm.UniButton1Click(Sender: TObject);

begin

  GRDconfig_LK.Columns[1].Filtering.enabled:=not GRDconfig_LK.Columns[1].Filtering.enabled;

  TExUniCustomDBGrid(GRDconfig_LK).DoConfigureJSColumns(GRDconfig_LK.DataSource.DataSet);

end;

 

It works fine the first time, then I get the following error:

 

 

 

 

O130 is not defined
 

 

delete O115_Cols;delete O115.view.cachedColumns; O198=new Ext.grid.column.Column({ogrid:O115,sortable:false,dataIndex:"0",renderer:_rndcll_,rdonly:true,text:" ",menuDisabled:true,width:20,unEditable:true});O198.nm="O198"; O199=new Ext.grid.column.Column({ogrid:O115,flex:1,dataIndex:"1",renderer:_rndcll_,rdonly:true,text:"Descrizione",menuDisabled:true,width:781,unEditable:true,items:[O130],fedit:O130,padding:"0 0 0 5"});O199.nm="O199";O130.setWidth(771);O199.on("afterrender",function(s){s.el.on("click",function(){O199.fedit.focus()})}); O19A=new Ext.grid.column.Column({ogrid:O115,dataIndex:"2",renderer:_rndcll_,rdonly:true,text:"Dal",menuDisabled:true,width:80,unEditable:true});O19A.nm="O19A"; O19B=new Ext.grid.column.Column({ogrid:O115,dataIndex:"3",renderer:_rndcll_,rdonly:true,text:"al",menuDisabled:true,width:80,unEditable:true});O19B.nm="O19B";var O115_Cols=[O198,O199,O19A,O19B];O115.reconfigure(null,O115_Cols);O115.uniConfigColumns();

O130 is not defined
 
  • 2 weeks later...
Posted

I've found the solution Delphi Dev. It seems that if the hidden panel is placed "below" other controls the problem arises.

In the test case I've prepared, if you select UniHiddenPanel1 in the structure view, then Control \ Bring To Front, everything works fine...

  • 1 year later...
Posted

Hi Sherzod,

going on porting our SW to EXTJS 6.

I used the above solution to open/close the filters at runtime, and in EXTJS 4.2 it worked pretty well.

In EXTJS6.5 calling "DoConfigureJSColumns"  makes the DbGrid lose the selection, the selected record is no longer highlighted

and you need to click on the grid to select it again.

Please find attached a simple test application, just select a record and push the ConfigureJSColumns button to recreate the issue.

I tried to call something like:

JSInterface.JSCall('view.refresh', []);

but it does not work...

thanks

Andrea

TestHints.zip

Posted

Hi,

Sorry, I did not fully checked

But, maybe like this for now..:

procedure TMainForm.UniButton1Click(Sender: TObject);
begin
  TExUniCustomDBGrid(DBgridLista).DoConfigureJSColumns(DBgridLista.DataSource.DataSet);
  DBgridLista.CurrRow := 0;
end;

 

Posted

Thank you, it works. Done this way:

procedure TMainForm.UniButton1Click(Sender: TObject);
var r: Integer;
begin
  r:=DBgridLista.CurrRow
  TExUniCustomDBGrid(DBgridLista).DoConfigureJSColumns(DBgridLista.DataSource.DataSet);
  DBgridLista.CurrRow:=;
end;

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...