Skip to main content



      Home
Home » Eclipse Projects » Eclipse Scout » TablePage pagination
TablePage pagination [message #1857434] Tue, 07 February 2023 12:16 Go to next message
Eclipse UserFriend
Hello,
I'm working with Scout classic version, and I have the problem of many rows in TablePages for large data size.

I read in multiple forum posts that this version does not support pagination and it is not considered its implementation.

With ScoutJS, is this possible?

Do you have any examples?

Thanks in advance.
Re: TablePage pagination [message #1857459 is a reply to message #1857434] Wed, 08 February 2023 12:11 Go to previous messageGo to next message
Eclipse UserFriend
Update: I've added navigation keys in the TablePage's status bar.
Column sort only works on data loaded into the page,
is there a way to sort all rows in the table?


@Data(ListinoTablePageData.class)
public class ListinoTablePage extends AbstractPageWithTable<Table>
{
    int maxRighePagina = 500;
    int rigaInizioCorrente = 0;
    int righeTotali = 0;
    boolean ricarica = true;
    ListinoTablePageData pageData = new ListinoTablePageData();

    @Override
    protected void addDefaultTableControls()
    {
	super.addDefaultTableControls();
	getTable().addTableControl(new PaginaAvantiTableControl());
	getTable().addTableControl(new PaginaInizioTableControl());
	getTable().addTableControl(new PaginaIndietroTableControl());
    }

    @Order(1000.0)
    public class PaginaIndietroTableControl extends AbstractFormTableControl
    {
	@Override
	protected void initConfig()
	{
	    super.initConfig();
	    setIconId(AbstractIcons.AngleLeftBold);
	    setTooltipText(TEXTS.get("PaginaIndietro"));
	}

	@Override
	public void setForm(IForm form)
	{
	    setEnabled(form != null);
	    super.setForm(form);
	}

	@Override
	protected void execSelectionChanged(boolean selected)
	{
	    if (selected)
	    {
		if (rigaInizioCorrente > 0)
		{
		    rigaInizioCorrente -= maxRighePagina;
		}
		ricarica = false;
		reloadPage();
	    }
	}

	@Override
	protected boolean getConfiguredVisible()
	{
	    return true;
	}

	@Override
	protected boolean getConfiguredEnabled()
	{
	    return false;
	}
    }

    @Order(1000.1)
    public class PaginaInizioTableControl extends AbstractFormTableControl
    {
	@Override
	protected void initConfig()
	{
	    super.initConfig();
	    setIconId(AbstractIcons.AngleUpBold);
	    setTooltipText(TEXTS.get("PaginaInizio"));
	}

	@Override
	public void setForm(IForm form)
	{
	    setEnabled(form != null);
	    super.setForm(form);
	}

	@Override
	protected void execSelectionChanged(boolean selected)
	{
	    if (selected)
	    {
		rigaInizioCorrente = 0;
		ricarica = false;
		reloadPage();
	    }
	}

	@Override
	protected boolean getConfiguredVisible()
	{
	    return true;
	}

	@Override
	protected boolean getConfiguredEnabled()
	{
	    return false;
	}
    }

    @Order(1000.2)
    public class PaginaAvantiTableControl extends AbstractFormTableControl
    {
	@Override
	protected void initConfig()
	{
	    super.initConfig();
	    setIconId(AbstractIcons.AngleRightBold);
	    setTooltipText(TEXTS.get("PaginaAvanti"));
	}

	@Override
	public void setForm(IForm form)
	{
	    setEnabled(form != null);
	    super.setForm(form);
	}

	@Override
	protected void execSelectionChanged(boolean selected)
	{
	    if (selected)
	    {
		if (righeTotali - rigaInizioCorrente > maxRighePagina)
		{
		    rigaInizioCorrente += maxRighePagina;
		}
		ricarica = false;
		reloadPage();
	    }
	}

	@Override
	protected boolean getConfiguredVisible()
	{
	    return true;
	}

	@Override
	protected boolean getConfiguredEnabled()
	{
	    return false;
	}
    }

    @Override
    protected void execLoadData(SearchFilter filter)
    {
	ClientSession.get().getDesktop().setTitle(getConfiguredTitle());
	if (ricarica)
	{
	    pageData = BEANS.get(IListinoService.class).getListinoTableData(filter);
	    rigaInizioCorrente = 0;
	}
	ricarica = true;
	ListinoTablePageData pgData = new ListinoTablePageData();
	righeTotali = pageData.getRowCount();
	if (righeTotali > maxRighePagina)
	{
	    for (ListinoTableRowData r : pageData.getRows())
	    {
		if (r.getId() >= rigaInizioCorrente && r.getId() < rigaInizioCorrente + maxRighePagina)
		{
		    if (pgData.getRowCount() == 0)
		    {
			if (r.getIdParent() != null && r.getIdParent() - 1 < rigaInizioCorrente)
			{
			    ListinoTableRowData r1 = pageData.rowAt(r.getIdParent() - 1);
			    if (r1.getIdParent() != null)
			    {
				pgData.addRow(pageData.rowAt(r1.getIdParent() - 1));
			    }
			    pgData.addRow(pageData.rowAt(r.getIdParent() - 1));
			}
		    }
		    pgData.addRow(r);
		}
	    }
	}
	else
	{
	    pgData = pageData;
	}
	importPageData(pgData);

	if (righeTotali > maxRighePagina)
	{
	    if (rigaInizioCorrente > 0)
	    {
		getTable().getTableControl(PaginaIndietroTableControl.class).setEnabled(true);
		getTable().getTableControl(PaginaInizioTableControl.class).setEnabled(true);
	    }
	    else
	    {
		getTable().getTableControl(PaginaIndietroTableControl.class).setEnabled(false);
		getTable().getTableControl(PaginaInizioTableControl.class).setEnabled(false);
	    }
	    if (righeTotali - rigaInizioCorrente > maxRighePagina)
	    {
		getTable().getTableControl(PaginaAvantiTableControl.class).setEnabled(true);
	    }
	    else
	    {
		getTable().getTableControl(PaginaAvantiTableControl.class).setEnabled(false);
	    }
	}
    }
Re: TablePage pagination [message #1857633 is a reply to message #1857459] Fri, 17 February 2023 06:03 Go to previous message
Eclipse UserFriend
Good morning,
i think i solved all the problems for sorting and selecting.

Only the list of lines visible in the menu remains.

index.php/fa/42955/0/

Does anyone know if it's possible to substitute the source of the list list from the visible table to the result of a sql query?
Previous Topic:Create own bean
Next Topic:FileChooser and Accepted File Extensions
Goto Forum:
  


Current Time: Tue Jun 24 03:46:34 EDT 2025

Powered by FUDForum. Page generated in 0.71146 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top