Jump to content

UniDBGrid Visible columns by code


rafpic62

Recommended Posts

I'm using a UniDBGrid on a Form and in the onshow event I set Some columns visible and some other not visible setting the .Visible property to True/False.

This will cause the application lock with screenmask always visible with "Loading data..." message. 

Have anyone experienced the same problem?

I'm using the 1479 build and upgrading to the recently purchased 1549. 

May be this issue was fixed from 1479 to 1549 ?

Link to comment
Share on other sites

This is the function that handles the columns. The columns to hide have the field name enclosed in square brackets. 

Columns are by default all visible at startup.

 

  procedure applyImpostazioniPratiche();
  var
    tsl: TStringList;
    s,fld: string;
    i,col: integer;
  begin
    s := UniMainModule.getUserImpostazioni();
    if(trim(s) <> '') then
    begin
      tsl := TStringList.Create;
      tsl.Text := s;
      for i := 0 to tsl.Count-1 do
      begin
        s := trim(tsl[i]);
        if s <> '' then
        begin
          if Pos('HIDDEN_COLUMNS=',s) = 1 then
          begin
            s := Copy(s,16, 1000);
            for col := 0 to gridPratiche.Columns.Count-1 do
            begin
              fld := Uppercase('['+gridPratiche.Columns[col].FieldName+']');
              if Pos(fld,s) > 0 then
                gridPratiche.Columns[col].Visible := False;
            end;
          end;
        end;
      end;
    end;

  end;

Link to comment
Share on other sites

  • 2 weeks later...

Sorry but the problem is still present. In few words with a dataset with a lot of records (about 1000) if I hide by code some grid columns it will freeze if I try do edit a single record and opening an edit form.

The problem doesn't occur if the dataset has few records.

Is there a way to programatically hide/show grid columns that you can suggest to me ?

Thank you V.M.

Link to comment
Share on other sites

55 minutes ago, rafpic62 said:

Sorry but the problem is still present. In few words with a dataset with a lot of records (about 1000) if I hide by code some grid columns it will freeze if I try do edit a single record and opening an edit form.

Hello,

Sorry, can you make a simple testcase to reproduce?

Link to comment
Share on other sites

Hi,

it's not simple to make a test case.

I have also experienced that the problem arises when I make visible a column with the unidbgrid default columns menu that allow to hide or show columns.

Is there a way to capture this event ? when the visible columns is changed through this menu?

I would try to refresh the underly dataset after that happen.

 

Thank you V.M.

 

Link to comment
Share on other sites

10 minutes ago, rafpic62 said:

Is there a way to capture this event ? when the visible columns is changed through this menu?

Hello,

Please clarify your problem again sequentially, what doesn't work and what do you want to achieve?

Link to comment
Share on other sites

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...