Skip to content

Пример таблицы с диалоговыми окнами #10

@ildar-ceo

Description

@ildar-ceo
namespace App.Frontend.Service;

use Runtime.Widget.Dialog.Dialog;
use Runtime.Widget.Events.MouseClickEvent;
use Runtime.Widget.Label;
use Runtime.Widget.Table.AddDialogButton;
use Runtime.Widget.Table.DeleteDialogButton;
use Runtime.Widget.Table.EditDialogButton;
use Runtime.Widget.Table.RefreshButton;
use Runtime.Widget.Table.RefreshEvent;
use Runtime.Widget.Table.RowButtons;
use Runtime.Widget.Table.RowNumber;
use App.Frontend.Service.ServiceForm;


class ServiceTable extends TableWidget
{
	
	/**
	 * Init widget
	 */
	void initWidget()
	{
		await parent::initWidget();
		
		this.setApiName("app.application");
		
		/* Add dialog */
		Dialog dialog = this.addWidget( new Dialog() );
		await dialog.initWidget();
		
		/* Add form */
		Form form = this.addWidget( new ServiceForm() );
		await form.initWidget();
		
		/* Add fields */
		this.addField({
			"name": "row_number",
			"component": new RowNumber,
		});
		this.addField({
			"name": "service_name",
			"component": new Label,
		});
		this.addField({
			"name": "status",
			"component": new Label,
		});
		this.addField({
			"name": "replicas",
			"component": new Label,
		});
		this.addField({
			"name": "row_buttons",
			"component": new RowButtons,
			"params": {
				"buttons": [
					(new EditDialogButton()).setDialog(dialog).setForm(form),
					(new DeleteDialogButton()).setDialog(dialog).setForm(form),
				],
			},
		});
		
		/* Add button */
		this.addTopButton( new AddDialogButton().setDialog(dialog).setForm(form) );
		
		/* Add refresh button */
		RefreshButton refresh_button = this.addTopButton( new RefreshButton() );
		refresh_button.addEvent( method this.onRefresh );
	}
	
	
	/**
	 * Load data
	 */
	async void loadWidget()
	{
		await parent::loadWidget();
		await this.getWidget("form").loadWidget();
	}
	
	
	/**
	 * Refresh event
	 */
	async void onRefresh(RefreshEvent event)
	{
	}
	
	
	/**
	 * Row click
	 */
	async void onRowClick(MouseClickEvent event)
	{
	}
	
	
	/**
	 * Row button click
	 */
	async void onRowButtonClick(MouseClickEvent event)
	{
	}
	
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions