Provide Control UI

From Documentation


You can change page, open/close node, or resize columns on the Pivottable component itself. However, for UI flexibility, the component itself does not provide control unit for other APIs, like to change pivot fields, toggle data field orientation, or sort the headers.

Simple controls

The following properties on Pivottable are very straightforward to wire up:

  • data field orientation
  • whether to show row/column grand totals

For example,

<pivottable id="pivot" />
<checkbox label="Enable grand total for columns" onCheck='pivot.setGrandTotalForColumns(self.isChecked())' />
<checkbox label="Enable grand total for rows" onCheck='pivot.setGrandTotalForRows(self.isChecked())' />
<radiogroup id="dataOrient">
	Data field orientation:
	<radio id="colOrient" label="column" onCheck='pivot.setDataFieldOrient("column")' />
	<radio id="rowOrient" label="row" onCheck='pivot.setDataFieldOrient("row")' />
</radiogroup>


 

Use PivotFieldControl to handle field setting

Compared to the others, field setting UI is much trickier to compose. Thus we have provided a macro component to simply the work.

ZUL:

<pivottable id="pivot" />
<pivot-field-control id="pfc" height="300px" /><!-- Remember to specify height -->

Composer:

public class PivotController extends GenericForwardComposer {
	private Pivottable pivot;
	private TabularPivotModel _model;
	private PivotFieldControl pfc;
	
	public void doAfterCompose(Component comp) throws Exception {
		super.doAfterCompose(comp);
		
		_model = MyPivotModelFactory.getModel(); // construct your pivot model
		pivot.setModel(_model);
		pfc.setModel(_model);
		
	}
}

It will look like:

ZKPivotEsn pfc control 01.png

The fields in the four area are draggable. You can move them to other pools, so the model and pivot table will be updated accordingly.

Sort options are available on row and column fields.

ZKPivotEsn pfc control 02.png


 

Customize PivotFieldControl

TODO: layout, labels

Version History

Last Update : 2011/11/22


Version Date Content
     



Last Update : 2011/11/22

Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License.