andyhill Posted March 26, 2023 Share Posted March 26, 2023 grdMyData is Focused, User Navigates to a specivic Row, User Clicks Toolbar Button, Row Data Out Of Sync with Grid View ??? procedure TfMain.btnDeleteClick(Sender: TObject); var DateStr: String; begin try grdMyData.SetFocus; grdMyData.RefreshCurrentRow(True); DateStr:= DateToStr(grdMyData.DataSource.DataSet.FieldByName('GivenDate').AsDateTime); // RETRIEVES WRONG DATA ??? MessageDlg(DateStr, mtConfirmation, [mbOK, mbYes], msgCongDeleteMyCallback); UniSession.AddJS('Ext.select("#messagebox-1001 .x-btn").elements[0].querySelectorAll(''[data-ref="btnInnerEl"]'')[0].innerHTML="Delete"'); UniSession.AddJS('Ext.select("#messagebox-1001 .x-btn").elements[1].querySelectorAll(''[data-ref="btnInnerEl"]'')[0].innerHTML="Cancel"'); except end; end; Quote Link to comment Share on other sites More sharing options...
Sherzod Posted March 26, 2023 Share Posted March 26, 2023 Hello, Sorry, do not understand what you talking about. Quote Link to comment Share on other sites More sharing options...
andyhill Posted March 26, 2023 Author Share Posted March 26, 2023 grdMyData is Focused, User Navigates to a specific Row, User Clicks Toolbar Button -OR- User RightClicks Grid Cell (_CellXY_), Row Data Out Of Sync with Grid View ??? s:= 'cellmousedown=function cellmousedown(sender, td, cellIndex, record, tr, rowIndex, e, eOpts) ' + '{ ' + ' var c = Ext.get(td).getXY(); ' + ' ajaxRequest(this, "_CellXY_", ["x="+c[0], "y="+c[1], "r="+rowIndex, "b="+e.button]); ' + ' sender.getEl().dom.addEventListener("contextmenu", function(e) ' + ' { ' + ' e.preventDefault(); ' + ' }) ' + '} '; grdMyData.ClientEvents.ExtEvents.Add(s); if EventName = '_CellXY_' then begin x:= StrToIntDef(Params.Values['x'], -1); y:= StrToIntDef(Params.Values['y'], -1); r:= StrToIntDef(Params.Values['r'], -1); b:= StrToIntDef(Params.Values['b'], -1); if ( (r > -1) and (b = 2) ) then begin try //DateStr:= DateToStr(UniMainModule.qryMyData.FieldByName('GivenDate').AsDateTime); DateStr:= DateToStr(grdMyData.DataSource.DataSet.FieldByName('GivenDate').AsDateTime); ShowMessage('Grid Row Number: '+IntToStr(r)+', GivenDate Fetch: '+DateStr); except end; end; end; Quote Link to comment Share on other sites More sharing options...
Sherzod Posted March 26, 2023 Share Posted March 26, 2023 Hello, I'm sorry. Attach a simple test case that we can reproduce your case. Quote Link to comment Share on other sites More sharing options...
andyhill Posted March 26, 2023 Author Share Posted March 26, 2023 SOLVED - My Fault, I was using legacy code to disable the "contextmenu" in the Grid ("contextmenu" is now controlled session wide by a MainModule parameter [missed seeing this update]) - sorry Sherzod. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted March 26, 2023 Share Posted March 26, 2023 Okay, no problem. Very good. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.