CGDevTools Forum

Welcome to the Official CGDevTools Support Community Forums.

Scroll through all rows in a grids.

by zsleo » 02 Feb 2018 05:19

I want to scroll through all rows in a grid - not just the displayed rows.

How can I do this in code

I am using

Code: Select all
    for lv_R := 0 to ip_Grid.RowCount - 1 do
    begin
      lv_S := '"' + ip_Grid.CellValues[0, lv_R] + '"';

      for lv_C := 1 to ip_Grid.JQGridColumns.Count - 1 do
      begin
        if VarIsNull(ip_Grid.CellValues[lv_C, lv_R]) then
          lv_S := lv_S + ',""'
        else
          lv_S := lv_S + ',"' + ip_Grid.CellValues[lv_C, lv_R] + '"';
      end;

      lv_SL.Add(lv_S);
    end;


..but it only scrolls through displayed rows.

TIA
zsleo
 
Posts: 777
Joined: 03 Feb 2013 03:33

by Alexander Bulei » 02 Feb 2018 11:02

Hi zsleo,

On server, you can use the data source directly...why you need loop the grid?

Best Regards.
Group: Developers | Support Team

  • info [at] cgdevtools.com - General information
  • sales [at] cgdevtools.com - Sales department
  • support [at] cgdevtools.com - Product and Technical Support
User avatar
Alexander Bulei
Site Admin
 
Posts: 3637
Joined: 15 May 2012 08:52
Location: Mealhada, Portugal

by zsleo » 02 Feb 2018 19:51

Hi Alexander

... because the user has the ability to change the columns displayed, the order of the columns and there are a number of columns that have values different than the dataset.

I would use Excel export but as you know the XLS file is corrupted.

Please, can you advise how I can do the iteration

TIA
zsleo
 
Posts: 777
Joined: 03 Feb 2013 03:33

by Alexander Bulei » 05 Feb 2018 15:11

Hi zsleo,

.. because the user has the ability to change the columns displayed, the order of the columns and there are a number of columns that have values different than the dataset.


I want to scroll through all rows in a grid - not just the displayed rows.


Ok, so what do you mean with not just the displayed rows? pagination?

Best Regards.
Group: Developers | Support Team

  • info [at] cgdevtools.com - General information
  • sales [at] cgdevtools.com - Sales department
  • support [at] cgdevtools.com - Product and Technical Support
User avatar
Alexander Bulei
Site Admin
 
Posts: 3637
Joined: 15 May 2012 08:52
Location: Mealhada, Portugal

by zsleo » 05 Feb 2018 21:15

Alexander,
I want l the same functionality as the Excel export that exports "corrupt"/"unusable" XLS files. Not a complete list but:
-- all record rows and columns that can be viewed in the grid
- paged and scrolled implementation
- grid search is user defined
- column visibility is used defined
- etc

TIA
zsleo
 
Posts: 777
Joined: 03 Feb 2013 03:33

by zsleo » 06 Feb 2018 19:38

I know I am pushing but is there a response to this.

I have users complaining that they can't view their extracts. ...

TIA
zsleo
 
Posts: 777
Joined: 03 Feb 2013 03:33

by Jorge Sousa » 06 Feb 2018 20:02

Hi Zsleo

you're not right about all this

I want to scroll through all rows in a grid - not just the displayed rows.

How can I do this in code

I am using

CODE: SELECT ALL
for lv_R := 0 to ip_Grid.RowCount - 1 do
begin
lv_S := '"' + ip_Grid.CellValues[0, lv_R] + '"';

for lv_C := 1 to ip_Grid.JQGridColumns.Count - 1 do
begin
if VarIsNull(ip_Grid.CellValues[lv_C, lv_R]) then
lv_S := lv_S + ',""'
else
lv_S := lv_S + ',"' + ip_Grid.CellValues[lv_C, lv_R] + '"';
end;

lv_SL.Add(lv_S);
end;


..but it only scrolls through displayed rows.


Because IT DOES scrolls all the rows, not only the displayed rows, unless you are using a custom loading code
Best Regards
CGDevTools Develop / Support Team
Home Page: http://www.cgdevtools.com
Jorge Sousa
 
Posts: 4261
Joined: 17 May 2012 09:58

by zsleo » 07 Feb 2018 22:51

Attached simple test case exports only 5 records but there are 6 records....

Place the data.kmd file in same directory as the exe
You do not have the required permissions to view the files attached to this post.
zsleo
 
Posts: 777
Joined: 03 Feb 2013 03:33

by Jorge Sousa » 08 Feb 2018 10:46

Hello

I'm sorry, since i've seen CellValues in your source code, in previous posts, i thought you were using CellsProvider

You must use the source of your data: kbmtbl1

the only thing i don't know is what is so special about column 0,

to respect the follow the column order, you can do:

Code: Select all
var
  Field: TField;

kbmtbl1.First;
while not kbmtbl1.Eof do
  begin
    for lv_C := 0 to ip_Grid.JQGridColumns.Count - 1 do
    begin
      Field:= kbmtbl1.FindField(ip_Grid.JQGridColumns[c].Name);
      if not Assigned(Field) or Field.IsNull then
        lv_S := lv_S + ',""'
      else
        lv_S := lv_S + ',"' + Field.Value + '"';
    end;
    lv_SL.Add(lv_S);
    kbmtbl1.Next;
  end;

    lv_SL.SaveToFile(lv_FN);

    iwcgjqfldwnld1.DownloadFileName(lv_FN);

    FreeAndNil(lv_SL);
Best Regards
CGDevTools Develop / Support Team
Home Page: http://www.cgdevtools.com
Jorge Sousa
 
Posts: 4261
Joined: 17 May 2012 09:58

by zsleo » 08 Feb 2018 12:55

Jorge,

As I stated this is a simple example.

How can I programmatically get:
- the columns that are shown because the user is able to show and hide columns
- get the values in the grid header search boxes because the user can narrow the selection for each column. I muse get the valuesame for the last actual search because the user may not actually press enter to activate the search after entering text

This is the only way I will be able to create the correct select statement for the dataset.

Please see my earlier post in this thread.

TIA
zsleo
 
Posts: 777
Joined: 03 Feb 2013 03:33

Next

Return to JQGrid

Who is online

Users browsing this forum: Google [Bot] and 1 guest

Contact Us.