Jump to content

TUniCustomDBGrid.MoveToRow(): Unexpected Row number: 0, 3.


erich.wanker

Recommended Posts

Hello ..

Used Version: 1.50.0.1480

first of all a video ;-) of the ramdom Error "TUniCustomDBGrid.MoveToRow(): Unexpected Row number:"

i dont find a reason or a solution ...

ThanX for help or support

i have this problem which comes randomly ( i found no reason)... 

right unidbgrid =  connected dataSource is "dliste" with dataset "liste"

left unidbgrid = connected dataSource is "dstruktur1" with dataset "struktur1"

procedure Tkunden_fakturieren.DSTRUKTUR1DataChange(Sender: TObject;
  Field: TField);
var s:string;
begin


    s:= STRUKTUR1.FieldByName('INR').asstring;
    if s='' then s:='-1';


    liste.SQL.Clear;
    liste.SQL.Append('SELECT * FROM ANTEILE WHERE GUNST_INR  = '+s+' AND MANDANT_INR = '+inttostr(unimainmodule.aktueller_mandant_nummer)+' AND FAKTURIERUNG_MONAT  = '+#39+fakturierungsmonat+#39+' ORDER BY VERTRAG_NR desc ');
    liste.Open;

 

the right uniDBGrid has following settings .. nothing special:

no_events.jpg.5fe00c4d217aa81cea61d785d8f90fa4.jpg

      object UniDBGrid1: TUniDBGrid
        AlignWithMargins = True
        Left = 11
        Top = 128
        Width = 458
        Height = 407
        Hint = ''
        Margins.Left = 10
        Margins.Top = 10
        Margins.Right = 10
        Margins.Bottom = 10
        ShowHint = True
        DataSource = Dliste
        Options = [dgTitles, dgRowSelect, dgCheckSelect, dgAlwaysShowSelection, dgConfirmDelete, dgMultiSelect, dgTabs, dgCancelOnExit]
        WebOptions.Paged = False
        WebOptions.PageSize = 50
        Grouping.FieldName = 'BENUTZERGRUPPE'
        Grouping.FieldCaption = #220'bersicht'
        LoadMask.Enabled = False
        LoadMask.Message = 'Loading data...'
        BorderStyle = ubsNone
        StripeRows = False
        Align = alClient
        TabOrder = 4
        Columns = <
          item
            FieldName = 'EINTRAG'
            Title.Caption = 'Entsch'#228'digung'
            Width = 150
            Sortable = True
          end
          item
            FieldName = 'SUMME_NETTO'
            Title.Caption = 'Summe Netto'
            Width = 70
            Sortable = True
          end
          item
            FieldName = 'VERTRAG_NAME'
            Title.Caption = 'Vertragsname'
            Width = 150
            Sortable = True
            ImageOptions.Visible = True
            ImageOptions.Width = 16
            ImageOptions.Height = 16
          end
          item
            FieldName = 'INDEXNAME'
            Title.Caption = 'Index'
            Width = 150
            Sortable = True
          end
          item
            FieldName = 'ZULETZT_FAKTURIERT'
            Title.Caption = 'Zuletzt fakturiert'
            Width = 100
            Sortable = True
          end
          item
            FieldName = 'VERRECHNEN'
            Title.Caption = 'Verrechnen'
            Width = 100
            Sortable = True
          end
          item
            FieldName = 'LEISTUNG_BEGINN'
            Title.Caption = 'Leistungsbeginn'
            Width = 100
            Sortable = True
          end
          item
            FieldName = 'LEISTUNG_ENDE'
            Title.Caption = 'Leistungsende'
            Width = 150
            Sortable = True
          end
          item
            FieldName = 'KATEGORIE'
            Title.Caption = 'Kategorie'
            Width = 64
            Sortable = True
          end>
      end
    end
  end

Link to comment
Share on other sites

i have a similar problem but i can reproduce in all case.

In my grid, i apply many filter on datasource that reload data in grid and as for erich.wanker, the issue seem to be displayed randomly when we use the selectall checkbox

i am using 1472 version

Link to comment
Share on other sites

  • 3 weeks later...
  • 5 weeks later...

I'm also having the same problem.
When using "Filter" / "Filtered = True" in FDQuery.
Error in function TUniCustomDBGrid.MoveToRow.
"UniDBGrid" is not automatically filtering.
After filtering and clicking the manually refresh uniDBGrid button, it updates the data, but the page count goes wrong.
Anyway, you're in trouble!
As I had already been informed by other colleagues, I figured that an update would soon come out.
My Version: ext-6.6.0 / uni-1.70.0.1485

Link to comment
Share on other sites

  • 1 month later...
  • 4 months later...

Also occurs in 1.50.0.1482.

But it's actually pretty random and hard to fake. I thought I was related to the Dataset.Locate that I use in a quick launch location window; but I've never been able to confirm this.

 

Link to comment
Share on other sites

  • 1 month later...
  • 2 weeks later...
  • 7 months later...

Hello, the exeption is in UniDBgrid.pas

  if (not Silent) and (DD.RecordCount > 0) then
    if Result <> ARecNo then
      ShowMessageN('TUniCustomDBGrid.MoveToRow(): Unexpected Row number: '+Format('%d, %d',[Result, ARecNo]));
      raise Exception.Create('TUniCustomDBGrid.MoveToRow(): Unexpected Row number: '+Format('%d, %d',[Result, ARecNo]));

In my case it rises in...

procedure TF_Muitine.UniDBGrid3AfterLoad(Sender: TUniDBGrid);
var
  DBGridJSName: string;
  _RecNo: Integer;
begin
  if UP_Aiksteleje.Visible = True then begin
    Try
      if UniMainModule.Mui_TR.RecordCount > 0 then begin
        DBGridJSName := UniDBGrid3.JSName;
        UniMainModule.Mui_Puspr.First;
        UniMainModule.Parinkta_Puspr:= 0;
        for _RecNo:= 0 to UniMainModule.Mui_Puspr.RecordCount - 1 do begin
          if UniMainModule.Mui_TR.FieldByName('Bendra_ter_Id').AsString = UniMainModule.Mui_Puspr.FieldByName('Bendra_ter_Id').AsString then begin
            UniSession.AddJS('setTimeout(function(){'+DBGridJSName + '.getSelectionModel().select('+ DBGridJSName +'.getStore().data.indexOfKey('+ IntToStr(_RecNo) +'), true)}, 50)');
            Inc(UniMainModule.Parinkta_Puspr);
            Break;
          end
          else begin
            UniSession.AddJS('setTimeout(function(){'+DBGridJSName + '.getSelectionModel().select(-1)}, 50)');
          end;
          UniMainModule.Mui_Puspr.Next;
        end;
        if UniMainModule.Parinkta_Puspr = 0 then
          UniSession.AddJS('setTimeout(function(){'+DBGridJSName + '.getSelectionModel().deselectAll()}, 50)'); <<<<<----- Here
      end;
    Except

    End;
  end;
end;

I guess after there is nothing to deselect or select.

Temporary I disabled an exception place, but it's not correct. Can you please fix that?

DBGrid.png

Link to comment
Share on other sites

  • 1 month later...
2 hours ago, eduardosuruagy said:

I'm having the same error and I still don't know why:

Error: TUniCustomDBGrid.MoveToRow (): Unexpected Row number: 21, 24

Hello, 

Which build are you using? 

Do you use a custom JS? 

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