Jump to content

Error using one singledbgrid with filters for diferents tables


zemorango

Recommended Posts

I Unigui Developers,
 
I Have a strange situation,
 
I have a form with some butons and a unidbgrid.  for each of the buttons I fill the grid with data from a table in sql server and aply filters to the grid according to the columns of the table i choose.
 
the filters apears and work  for the first tabble and second table, the grid is filled correctly and the filters works, but if I click on the first button again to load back the date form the first table then I get an error.

 

Before I fill the grid I clear all the columns and set the filter component of each columns to nil;

 

I'm sending some imagens in attachement

 // make sure to remove the filter components from the grid columns
      for i := 0 to JanListagens.GridRelatorio.Columns.Count-1  do begin
         JanListagens.GridRelatorio.Columns[i].Filtering.Editor:=nil;
      end;


     // clear the columns
     JanListagens.GridRelatorio.Columns.Clear;

     // load the grid with dataset  the SQL is diferent with more or less colums depending of the table i'm loading
     GetData(self, JanListagens.Provtmp, JanListagens.CDStmp,sql, JanListagens.GridRelatorio, JanListagens.Dtstmp);


     // configure the filters, all uniedit simple text.
     for i := 0 to JanListagens.GridRelatorio.Columns.Count-1  do begin
              if (JanListagens.GridRelatorio.Columns[i].Field <> Nil)
               then begin

                Comp:=JanListagens.findcomponent('Edit_'+UniMainModule.listActualTabela.ToString+'_'+i.ToString) as TuniEdit ;

                if Comp<>nil then
                begin
                  comp.EmptyText:=JanListagens.GridRelatorio.Columns[i].FieldName+'...';
                  JanListagens.GridRelatorio.Columns[i].Width:=200;
                  JanListagens.GridRelatorio.Columns[i].Filtering.enabled:=true;
                  JanListagens.GridRelatorio.Columns[i].Filtering.Editor:=comp;
                  JanListagens.GridRelatorio.Columns[i].Title.Font.Size:=9;
                  JanListagens.GridRelatorio.Columns[i].Sortable:=true;
                end;

               end;
           end;

do I need to make some kind of cache operation to clean the filters in javascript?

 

Regards

 

zemorango

 

 

 

post-2058-0-56128300-1528727923_thumb.png

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