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] BBjGridExWidget Date Filter Layout Issue #266

Open
hyyan opened this issue Jul 30, 2024 · 0 comments
Open

[Bug] BBjGridExWidget Date Filter Layout Issue #266

hyyan opened this issue Jul 30, 2024 · 0 comments
Assignees
Labels
Client: GUI the issues is related to GUI applications

Comments

@hyyan
Copy link
Member

hyyan commented Jul 30, 2024

From Audev:

When attempting to filter data using the date selection calendar, we're facing a layout problem. The calendar widget is larger than the grid's available space, resulting in a vertical scrollbar. Our users prefer to avoid scrolling and would like the calendar to fit within the grid's dimensions. We've explored the possibility of disabling the calendar and allowing direct date input, but direct date input option seems deprecated. We're seeking a solution to either:

  • Resize the calendar widget to fit within the grid.
  • Enable direct date input for the filter.

Additional information:
We are using BBj version 22.15 and BBjGridExWidget version 1.12.0

use ::BBjGridExWidget/BBjGridExWidget.bbj::BBjGridExWidget

use com.basiscomponents.bc.SqlQueryBC
use com.basiscomponents.db.ResultSet
use com.basiscomponents.db.DataRow
use java.sql.Types

? 'HIDE',

declare auto BBjTopLevelWindow wnd!
declare auto BBjListButton lb_db!
declare auto BBjListButton lb_tbl!
declare auto BBjToolButton btn_fit!
declare BBjGridExWidget grid!

wnd! = BBjAPI().openSysGui("X0").addWindow(10,10,1450,400,"Editing Demo")

startEditingZero! = wnd!.addButton(300,10,10,200,25,"Start Editing (1 , DOUBLE)")
startEditingZero!.setCallback(BBjAPI.ON_BUTTON_PUSH,"startEditingZeroFunc")

startEditingDelete! = wnd!.addButton(301,220,10,200,25,"Start Editing (1, DOUBLE , 46)")
startEditingDelete!.setCallback(BBjAPI.ON_BUTTON_PUSH,"startEditingDeleteFunc")

startEditingFill! = wnd!.addButton(302,430,10,200,25,"Start Editing (1 , DOUBLE , '200')")
startEditingFill!.setCallback(BBjAPI.ON_BUTTON_PUSH,"startEditingFillFunc")

stopEditing! = wnd!.addButton(303,640,10,100,25,"Stop Editing")
stopEditing!.setCallback(BBjAPI.ON_BUTTON_PUSH,"stopEditingFunc")

stopEditing! = wnd!.addButton(304,750,10,130,25,"Stop And Cancel Editing")
stopEditing!.setCallback(BBjAPI.ON_BUTTON_PUSH,"stopAndCancelEditingFunc")

actions! = wnd!.addCEdit(305,10,600,300,150,"")
actions!.setOpaque(0)

wnd!.setCallback(BBjAPI.ON_CLOSE,"byebye")
wnd!.setCallback(BBjAPI.ON_RESIZE,"resize")

grid! = new BBjGridExWidget(wnd!,100,10,50,1430,550)
grid!.getOptions().setEnableFilter(1)
grid!.getOptions().getDefaultColumnDefinition().setFloatingFilter(1)

rem enable grid editing based on EDITABLE flag in DataRow Attribute
grid!.getOptions().setEditable(1)
grid!.getOptions().setSingleClickEdit(1)
grid!.getOptions().setEditType(grid!.GRID_EDITTYPE_CELL());		rem see also: _ROW())
rem see also: grid!.setEnterKeyBehavior(grid!.GRID_ENTER_NEXT_CELL())

grid!.setCallback(grid!.ON_GRID_ROW_EDITING_STARTED(),"rowEditingStarted");rem no-op if not edittype_row
grid!.setCallback(grid!.ON_GRID_ROW_EDITING_STOPPED(),"rowEditingStopped");rem no-op if not edittype_row

grid!.setCallback(grid!.ON_GRID_CELL_VALUE_CHANGED(),"cellEditingChanged")

gosub fillGrid

REM The numbers cell editor is a normal <input type="number"> 
REM you will need to set up the allowed step 

double! = grid!.getColumn("DOUBLE")
double!.getCellEditor().setStep(.01)


process_events

startEditingZeroFunc:
    grid!.stopEditing(1)
    grid!.setStartCellEditing(1,"DOUBLE")
return

startEditingDeleteFunc:
    grid!.stopEditing(1)
    rem KEY CODE for DELETE key is 46
    grid!.setStartCellEditing(1,"DOUBLE",46)
return

startEditingFillFunc:
    grid!.stopEditing(1)
    grid!.setStartCellEditing(1,"DOUBLE","200")
return

stopEditingFunc:
    grid!.stopEditing(0)
return

stopAndCancelEditingFunc:
    grid!.stopEditing(1)
return

fillGrid:
    rs! = new ResultSet()

    i=1
    x=2.13

    for j=1 to 2

        dr! = new DataRow()
        dr!.setFieldValue("ID",java.sql.Types.VARCHAR,"ID_" + STR(i))
        dr!.setFieldValue("DATE",java.sql.Types.DATE,"1979-08-03")
        dr!.setFieldValue("DOUBLE",java.sql.Types.DOUBLE,x)
        dr!.setFieldValue("TIMESTAMP",java.sql.Types.TIMESTAMP,"2018-01-02 12:22:13")
        dr!.setFieldValue("BOOLEAN",java.sql.Types.BOOLEAN,MOD(i,3)=0)
        dr!.setFieldValue("INTEGER",java.sql.Types.INTEGER,i)
        dr!.setFieldValue("SELECT",java.sql.Types.VARCHAR,STR(i))

        if i=1 then
            dr!.setFieldAttribute("DOUBLE","EDITABLE","1")
            dr!.setFieldAttribute("DOUBLE","MASK","-### ##0.0000")
			
            dr!.setFieldAttribute("BOOLEAN","EDITABLE","1")

            dr!.setFieldAttribute("DATE","MASK","%Dz.%Mz.%Yl")
            dr!.setFieldAttribute("DATE","EDITABLE","1")

            dr!.setFieldAttribute("TIMESTAMP","MASK","%Yd-%Mz-%Dz %Hz:%mz:%sz")
            dr!.setFieldAttribute("TIMESTAMP","EDITABLE","1")
        fi

        rs!.addItem(dr!)

        i=i+1
        x=x*-i

        dr! = new DataRow()
        dr!.setFieldValue("ID",java.sql.Types.VARCHAR,"ID_" + STR(i))
        dr!.setFieldValue("DATE",java.sql.Types.DATE,"2013-02-01")
        dr!.setFieldValue("DOUBLE",java.sql.Types.DOUBLE,x)
        dr!.setFieldValue("TIMESTAMP",java.sql.Types.TIMESTAMP,"2016-11-12 23:22:00")
        dr!.setFieldValue("BOOLEAN",java.sql.Types.BOOLEAN,MOD(i,3)=0)
        dr!.setFieldValue("INTEGER",java.sql.Types.INTEGER,i)
        dr!.setFieldValue("SELECT",java.sql.Types.VARCHAR,STR(i))

        rs!.addItem(dr!)
        rem grid!.setStartCellEditing(1,"DOUBLE");rem why is this here in the loop?

        i=i+1
        x=x*-i

    next

    grid!.setData(rs!,"ID")

    use ::BBjGridExWidget/GxColumns.bbj::GxColumn
    declare GxColumn column!
    column! = grid!.getColumn("SELECT")
    use ::BBjGridExWidget/GxCellEditors.bbj::GxCellEditorRichSelect
    declare GxCellEditorRichSelect edselect!
    edselect! = new GxCellEditorRichSelect()
    use com.google.gson.JsonArray
    declare JsonArray values!
    values! = new JsonArray()
    for n=1 to 5; values!.add(str(n)); next n
    edselect!.setValues(values!)
    column!.setCellEditor(edselect!)
return

byebye:
    bye

resize:
    ev! = BBjAPI().getLastEvent()
    grid!.setSize(ev!.getWidth()-20,550)
return

rowEditingStarted:
    ev! = BBjAPI().getLastEvent()
    ev! = ev!.getObject()
    actions!.removeAll()
    actions!.addParagraph(0,"Row Editing Started  : ID = " + ev!.getRow().getId())
return

rowEditingStopped:
    ev! = BBjAPI().getLastEvent()
    ev! = ev!.getObject()
    actions!.removeAll()
    actions!.addParagraph(0,"Row Editing Stopped  : ID = " + ev!.getRow().getId())
return

cellEditingChanged:
    ev! = BBjAPI().getLastEvent()
    ev! = ev!.getObject()
    actions!.removeAll()
    actions!.addParagraph(0,"Cell Editing Started : ROW ID     = " + ev!.getRow().getId() + $0a$ +
:                           "                     : Column     = " + ev!.getColumn().getName() + $0a$ +
:                           "                     : New Value = " + ev!.getValue() + $0a$ +
:                           "                     : Old Value = " + ev!.getOldValue() + $0a$)
return
@hyyan hyyan added the Client: GUI the issues is related to GUI applications label Jul 30, 2024
@hyyan hyyan self-assigned this Jul 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Client: GUI the issues is related to GUI applications
Projects
None yet
Development

No branches or pull requests

1 participant