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

ColumnResize sending spurious events #855

Closed
howudodat opened this issue Oct 16, 2023 · 0 comments
Closed

ColumnResize sending spurious events #855

howudodat opened this issue Oct 16, 2023 · 0 comments
Assignees
Labels
bug Something isn't working version 1.x.x Version 1.x.x issues version 2.x.x Version 2.x.x issues
Projects
Milestone

Comments

@howudodat
Copy link

Describe the bug
Adding ResizeColumnsPlugin to a table causes Resize event to be sent at odd times. For example a resize event is sent when you click on a row. I am also seeing resize events if a dialog is visible and you click on elements in the dialog.

To Reproduce
The below code shows the error. click on any row and you'll see the resize event in the console

Expected behavior
I would guess that resize events should only be sent on an actual resize

	public class PnlTableTest extends BaseElement<HTMLDivElement, PnlTableTest>  {

		protected LocalListDataStore<tabledata> ds = new LocalListDataStore<>();

		public PnlTableTest() {
			super(ElementsFactory.elements.div().element());
			this.appendChild(div()
				.addCss(dui_flex, dui_flex_col)
				.appendChild(createTable())
			);
			
			ArrayList<tabledata> alData = new ArrayList<>();
			for (int x=0; x<10; x++)
				alData.add(new tabledata("Test "+x));
			ds.setData(alData);
		}

		protected DataTable<tabledata> createTable() {
			TableConfig<tabledata> tableConfig = new TableConfig<>();
			tableConfig.addColumn(
				ColumnConfig.<tabledata>create("Label", "Label")
					.setCellRenderer(
						cell -> { return text(cell.getTableRow().getRecord().label); }))

				.setFixed(true)
				.setFixedBodyHeight(Calc.sub(Unit.vh.of(100), Unit.px.of(115)))
				.addPlugin(new ResizeColumnsPlugin<tabledata>().configure(config -> config.setClipContent(true)))
				.addPlugin(new RowClickPlugin<>(row -> { GWT.log("CLICKED:"+row.getRecord().label); }))
			;

			DataTable<tabledata> tbl = new DataTable<>(tableConfig, ds);
			tbl.removeCss("dui-datatable-striped");
			tbl.addTableEventListener(ColumnResizedEvent.COLUMN_RESIZED, evt -> {
				ColumnResizedEvent event = Js.uncheckedCast(evt);
				GWT.log(evt.getType() + " - " + evt.toString());
				GWT.log(event.getColumn().getTitle() + " = " + event.getSizeDiff());
			});
			return tbl;
		}
	}

	/**
	 * This is the entry point method.
	 */
	public void onModuleLoad() {
		var layout = AppLayout.create("Domino-ui test");

		layout.withContent((parent1, content) -> {
			content.appendChild(new PnlTableTest());
		});

		body().appendChild(layout);

		new DlgTest().open();
	}
}

you can also see the full test project here: https://github.com/howudodat/domtest

@vegegoku vegegoku self-assigned this Oct 26, 2023
@vegegoku vegegoku added bug Something isn't working version 1.x.x Version 1.x.x issues version 2.x.x Version 2.x.x issues labels Oct 26, 2023
@vegegoku vegegoku added this to To do in Domino UI via automation Oct 26, 2023
@vegegoku vegegoku added this to the 2.0.0-RC4 milestone Oct 26, 2023
Domino UI automation moved this from To do to Done Oct 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working version 1.x.x Version 1.x.x issues version 2.x.x Version 2.x.x issues
Projects
Domino UI
  
Done
Development

No branches or pull requests

2 participants