Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Grid fails to focus and start editing a column if its empty #245

Closed
TimonGeisbauer opened this issue Sep 30, 2022 · 0 comments
Closed
Assignees
Labels
Area: Core Javascript The issue is related to the central Javascript code Status: Confirmed The issue is a bug and has been confirmed and an action will be taken Status: Fixed in dev A fix is ported to the dev branch Type: Bug The issue documents broken, incorrect, or confusing behavior.

Comments

@TimonGeisbauer
Copy link

The Grid prints an error to the console if you want to focus or start a cellEdit

If you comment the lines where i add one DataRow and run it you can see it works as it should.
With out this the following error gets printed: "TypeError: Cannot read properties of undefined (reading 'rowIndex')"

use ::BBjGridExWidget/BBjGridExWidget.bbj::BBjGridExWidget
use com.basiscomponents.db.ResultSet
use com.basiscomponents.db.DataRow

use ::BBjGridExWidget/GxColumns.bbj::GxColumn
use ::BBjGridExWidget/GxClientEvents.bbj::GxClientEventsCell

sysgui! = BBjAPI().openSysGui("X0")
wnd! = sysgui!.addWindow(0,0,800,600,"GridExSample")

wnd!.setCallback(BBjAPI.ON_CLOSE,"byebye")
grid! = new BBjGridExWidget(wnd!,9876,0,0,wnd!.getWidth(),wnd!.getHeight())
grid!.setCallback(grid!.ON_GRID_CELL_EDITING_STOPPED(),"onEditingCompleted")

rem grid!.getOptions().setStopEditingWhenGridLosesFocus(1)

c! = new GxColumn("1_")
c!.setEditable(1)
grid!.addColumn(c!)
c! = new GxColumn("2_")
c!.setEditable(1)
grid!.addColumn(c!)
c! = new GxColumn("3_")
c!.setEditable(1)
grid!.addColumn(c!)
c! = new GxColumn("4_")
c!.setEditable(1)
grid!.addColumn(c!)
c! = new GxColumn("5_")
c!.setEditable(1)
grid!.addColumn(c!)
c! = new GxColumn("6_")
c!.setEditable(1)
grid!.addColumn(c!)
c! = new GxColumn("7_")
c!.setEditable(1)
grid!.addColumn(c!)
c! = new GxColumn("8_")
c!.setEditable(1)
grid!.addColumn(c!)

dr! = new DataRow()
dr!.setFieldValue("__INDEX__","0123456789")
for i = 1 to 8 
dr!.setFieldValue(str(i) + "_","")
next i

rs! = new ResultSet()
rs!.add(dr!)
grid!.setPinnedBottomRows(rs!)

data! = new ResultSet()
rem entry! = new DataRow()
rem entry!.setFieldValue("1_","test")
rem entry!.setFieldValue("2_","test")
rem entry!.setFieldValue("3_","test")
rem entry!.setFieldValue("4_","test")
rem entry!.setFieldValue("5_","test")
rem entry!.setFieldValue("6_","test")
rem entry!.setFieldValue("7_","test")
rem entry!.setFieldValue("8_","test")
rem data!.add(entry!)

grid!.setData(data!)

process_events

onEditingCompleted:
ev! = BBjAPI().getLastEvent()
declare auto GxClientEventsCell cell!
declare DataRow dr!

declare BBjString cname!

cell! = ev!.getObject()
cname! = cell!.getColumn().getName()

if (cname! = "8_") then 
    grid!.setVisibleColumn("1_")
    grid!.setStartCellEditing(0,"1_",-1,"",grid!.GRID_FLOATING_BOTTOM())
    grid!.focus(0,"1_",grid!.GRID_FLOATING_BOTTOM())
endif

return

byebye:
    release
@hyyan hyyan added Type: Bug The issue documents broken, incorrect, or confusing behavior. Area: Core Javascript The issue is related to the central Javascript code Status: Confirmed The issue is a bug and has been confirmed and an action will be taken Status: WIP Work in progress labels Oct 25, 2022
@hyyan hyyan closed this as completed in cc3092a Oct 25, 2022
@hyyan hyyan added Status: Fixed in dev A fix is ported to the dev branch and removed Status: WIP Work in progress labels Oct 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Core Javascript The issue is related to the central Javascript code Status: Confirmed The issue is a bug and has been confirmed and an action will be taken Status: Fixed in dev A fix is ported to the dev branch Type: Bug The issue documents broken, incorrect, or confusing behavior.
Projects
None yet
Development

No branches or pull requests

2 participants