Jump to content

Recommended Posts

Posted

How Can I auto size TUnimDBGrid column to available space or something like flex?

I want my last column to fit  available space. I could do it in the desktop components. But it's not possible in mobile.

Thank you

Posted
On 7/12/2020 at 2:36 AM, Mehmet Emin said:

I want my last column to fit  available space.

Hello,

Can you try this approach?

procedure TMainmForm.UnimFormReady(Sender: TObject);
begin
  with UnimDBGrid1 do
    JSInterface.JSCall('setFlex', [1], Columns[Columns.Count-1].JSColumn);
end;

 

  • 10 months later...
Posted

in Build 1549, If you want to forcefit equal width colums,  this is not functional :

procedure TMainmForm.UnimFormReady(Sender: TObject);
begin
  UnimDBGrid1.JSInterface.JSCall('setFlex', [1], Columns[0].JSColumn);
  UnimDBGrid1.JSInterface.JSCall('setFlex', [1], Columns[1].JSColumn);
end;

Use instead this :

procedure TMainmForm.UnimFormReady(Sender: TObject);
begin
   UnimDBGrid1.JSInterface.JSConfig('width', ['50%'], dbg.Columns[0].JSColumn);
   UnimDBGrid1.JSInterface.JSConfig('width', ['50%'], dbg.Columns[1].JSColumn);
end;

 

Posted

I am on version 1.90.0.1549 and using setFlex for the last columns of my grids still working. But I will use your approach if need equal fit of the columns. So thanks for the tip

  • 3 weeks later...
Posted
On 7/16/2020 at 12:58 PM, Sherzod said:

Hello,

Can you try this approach?


procedure TMainmForm.UnimFormReady(Sender: TObject);
begin
  with UnimDBGrid1 do
    JSInterface.JSCall('setFlex', [1], Columns[Columns.Count-1].JSColumn);
end;

 

For cbuilder:

 

void __fastcall TMainmForm::UnimFormReady(TObject *Sender)

{

UnimDBGrid1->JSInterface->JSCall("setFlex","1",UnimDBGrid1->Columns->Items[UnimDBGrid1->Columns->Count-1]->JSColumn)   ;

}

×
×
  • Create New...