Jump to content

dbgrid with ext 6.6


jahlxx

Recommended Posts

Hi.

 

I'm testing new beta version with ext 6.5

 

I have 2 quiestions.

 

- This code don't work. I have it in mainform script:

Ext.override(Ext.view.Table, {
    walkCells: function (pos, direction, e, preventWrap, verifierFn, scope) {                   
      var grid = pos.view.headerCt.grid;   
      if ((direction == 'right' && grid.columnManager.columns[pos.column+1] ) ||
        (direction == 'left' && grid.columnManager.columns[pos.column-1] ) ||
        (direction == 'down' || direction == 'up'))
      {
        return this.callParent(arguments);
      } else {
        return false;
      }
    }            
});
 

 

- This, in custom css, only show horizontal lines:

 

.x-grid-with-row-lines .x-grid-td {
   border-color: black;
}

.x-grid-with-col-lines .x-grid-cell {
   border-color: black;
}
 

 

- And this has a extrange behaviour too:

 

   if (key = VK_NEXT) then
      (sender as tunidbgrid).datasource.Dataset.RecNo := (sender as tunidbgrid).datasource.Dataset.RecNo + (sender as tunidbgrid).WebOptions.PageSize;

   if (key = VK_PRIOR) then
      (sender as tunidbgrid).datasource.Dataset.RecNo := (sender as tunidbgrid).datasource.Dataset.RecNo - (sender as tunidbgrid).WebOptions.PageSize;

 

   if (Key = VK_DOWN)and((Sender as TUniDBGrid).WebOptions.Paged) then  begin
      if ((Sender as TUniDBGrid).DataSource.DataSet.RecNo mod (Sender as TUniDBGrid).WebOptions.PageSize) = 0 then
        (Sender as TUniDBGrid).DataSource.DataSet.Next
   end;

   if (Key = VK_UP)and((Sender as TUniDBGrid).WebOptions.Paged) then  begin
      if (((Sender as TUniDBGrid).DataSource.DataSet.RecNo - 1) mod (Sender as TUniDBGrid).WebOptions.PageSize) = 0 then
        (Sender as TUniDBGrid).DataSource.DataSet.Prior
   end;
 

 

 

Thanks.

 

Link to comment
Share on other sites

  • 2 weeks later...

- This code don't work. I have it in mainform script:

Ext.override(Ext.view.Table, {

    walkCells: function (pos, direction, e, preventWrap, verifierFn, scope) {                   

      var grid = pos.view.headerCt.grid;   

      if ((direction == 'right' && grid.columnManager.columns[pos.column+1] ) ||

        (direction == 'left' && grid.columnManager.columns[pos.column-1] ) ||

        (direction == 'down' || direction == 'up'))

      {

        return this.callParent(arguments);

      } else {

        return false;

      }

    }            

});

 

Can you try this ?: pos.column changed to pos.colIdx

Ext.override(Ext.view.Table, {
    walkCells: function(pos, direction, e, preventWrap, verifierFn, scope) {
        var grid = pos.view.headerCt.grid;
        if ((direction == 'right' && grid.columnManager.columns[pos.colIdx + 1]) ||
            (direction == 'left' && grid.columnManager.columns[pos.colIdx - 1]) ||
            (direction == 'down' || direction == 'up')) {
            return this.callParent(arguments);
        } else {
            return false;
        }
    }
});
Link to comment
Share on other sites

Hi.

 

Sorry for the delay.

 

DD: it seems that your code works.

 

Stefano: Ye. I need this for move in the grid with arrow keys. When the grid is paged, when I'm in the last row (record) of one page, when press down arrow go to the next page to it's first row. And when I am in the first row of one page, and press up arrow, go to the priog page, to it's last row.

 

Thanks.

Link to comment
Share on other sites

Yes, it works in 4.2

 

I try to clarify.

 

I have a grid, paged (25 records per page), and in keydown, this:

 

- AvPag: Go to next page

- RePag: Go to prior page

- KeyDown: Go to next record. If the record is the last in one page, go to the first record of the next page

- KeyUp: Go to prios record. If the record is the first in one page, go to the last record of the prior page

 

This works in 4.2 but don't work in 6.5

 

I hope this is more clear.

 

Thanks.

Link to comment
Share on other sites

ok.

 

here is a test made with 6.5, and the same with 4.2.

 

the only diff. between them is the mainform script (as suggested by DD, in 6.5, changing pos.column to pos.colIdx).

 

you can see the difference, navigating with keys (arrow keys, start, end, avpag, repag), and the difference in showing the grid. is not showed as uniservermodule.customcss (only shows vertical lines).

 

thanks.

 

test65.zip

test42.zip

Link to comment
Share on other sites

  • 10 months later...
On 1/26/2018 at 5:53 PM, jahlxx said:

Hi.

 

I'm testing new beta version with ext 6.5

 

I have 2 quiestions.

 

- This code don't work. I have it in mainform script:

Ext.override(Ext.view.Table, {
    walkCells: function (pos, direction, e, preventWrap, verifierFn, scope) {                   
      var grid = pos.view.headerCt.grid;   
      if ((direction == 'right' && grid.columnManager.columns[pos.column+1] ) ||
        (direction == 'left' && grid.columnManager.columns[pos.column-1] ) ||
        (direction == 'down' || direction == 'up'))
      {
        return this.callParent(arguments);
      } else {
        return false;
      }
    }            
});
 

 

- This, in custom css, only show horizontal lines:

 

.x-grid-with-row-lines .x-grid-td {
   border-color: black;
}

.x-grid-with-col-lines .x-grid-cell {
   border-color: black;
}
 

 

- And this has a extrange behaviour too:

 

   if (key = VK_NEXT) then
      (sender as tunidbgrid).datasource.Dataset.RecNo := (sender as tunidbgrid).datasource.Dataset.RecNo + (sender as tunidbgrid).WebOptions.PageSize;

   if (key = VK_PRIOR) then
      (sender as tunidbgrid).datasource.Dataset.RecNo := (sender as tunidbgrid).datasource.Dataset.RecNo - (sender as tunidbgrid).WebOptions.PageSize;

 

   if (Key = VK_DOWN)and((Sender as TUniDBGrid).WebOptions.Paged) then  begin
      if ((Sender as TUniDBGrid).DataSource.DataSet.RecNo mod (Sender as TUniDBGrid).WebOptions.PageSize) = 0 then
        (Sender as TUniDBGrid).DataSource.DataSet.Next
   end;

   if (Key = VK_UP)and((Sender as TUniDBGrid).WebOptions.Paged) then  begin
      if (((Sender as TUniDBGrid).DataSource.DataSet.RecNo - 1) mod (Sender as TUniDBGrid).WebOptions.PageSize) = 0 then
        (Sender as TUniDBGrid).DataSource.DataSet.Prior
   end;
 

 

 

Thanks.

 

 

Your code was useful ...
I just improved a bit to avoid mistakes and stay clean !!!
I hope it helps you tb ...

But I only have one difficulty ... if I hold the key pressed, debugging the code, to realize that there is a very large delay ... so sometimes the strange behavior that you quoted ..

But it's better than nothing !!!

Thank you friend!!!

 

 

procedure TfCadastro.grdCadastroKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin

  if (Sender as TUniDBGrid).WebOptions.Paged then

  begin
    case key of
      VK_NEXT  : begin
                   if (((sender as tunidbgrid).datasource.Dataset.RecNo + (sender as tunidbgrid).WebOptions.PageSize) > (sender as tunidbgrid).datasource.Dataset.RecordCount) then
                     (sender as tunidbgrid).datasource.Dataset.Last
                   else
                     (sender as tunidbgrid).datasource.Dataset.RecNo := (sender as tunidbgrid).datasource.Dataset.RecNo + (sender as tunidbgrid).WebOptions.PageSize;
                 end;

      VK_PRIOR : begin
                   if (((sender as tunidbgrid).datasource.Dataset.RecNo - (sender as tunidbgrid).WebOptions.PageSize) < 1) then
                     (sender as tunidbgrid).datasource.Dataset.First
                   else
                    (sender as tunidbgrid).datasource.Dataset.RecNo := (sender as tunidbgrid).datasource.Dataset.RecNo - (sender as tunidbgrid).WebOptions.PageSize;
                 end;

      VK_DOWN  : begin
                   if ((Sender as TUniDBGrid).CurrRow = ((Sender as TUniDBGrid).WebOptions.PageSize) -1) then
                     (Sender as TUniDBGrid).DataSource.DataSet.Next;
                 end;
      VK_UP    : begin
                   if ((Sender as TUniDBGrid).CurrRow = 0) then
                     (Sender as TUniDBGrid).DataSource.DataSet.Prior;
                 end;

    end;
  end;

end;

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...