0

Getting the position of the Horizontal Scrollbar in a grid

asked 2013-09-06 10:28:17 +0800

mradharani gravatar image mradharani
1

Hi All,

I have a grid displaying data ( spreadsheet ). I want to display the data by default at a particular position of a horizontal scrollbar of the grid which I am using. Can anyone please help me in solving it.

In other words, I need the focus of the horizontal scrollbar at a particular position by default in a grid.

delete flag offensive retag edit

2 Replies

Sort by ยป oldest newest

answered 2013-09-16 11:58:36 +0800

mradharani gravatar image mradharani
1

FoodController ( My Controller )

package zk.support.steelwedge;

import org.zkoss.zk.ui.Component; import org.zkoss.zk.ui.select.SelectorComposer; import org.zkoss.zk.ui.select.annotation.Wire; import org.zkoss.zk.ui.util.Clients; import org.zkoss.zul.Grid; import org.zkoss.zul.ListModel; import org.zkoss.zul.ListModelList;

public class FoodController extends SelectorComposer<component> { private static final long serialVersionUID = 1L; private final FoodData foodCtrl = new FoodData(); int cnt = 0;

public ListModel<Food> getFooddetails() {
    return new ListModelList<Food>(foodCtrl.getFoodDetails(), true);
}

public String[] getFoodlistsize() {
    return new String[foodCtrl.size()];
}

public int getColumnStartIndex() {
    return 4; //zero based start index
}

}

example5.zul ( My UI page)

<grid model="${$composer.fooddetails}" id="test"> <frozen style="background: #DFDED8" columns="1" start="${$composer.columnStartIndex}">

</frozen> <auxhead> <auxheader label="Apple"></auxheader> </auxhead> <columns> <column label="Category" sort="auto(category)"/> <column foreach="${$composer.foodlistsize}" label="Item${forEachStatus.index + 1}"/> </columns> <template name="model"> <row> <cell> <label value="${each.category}"/> </cell> <cell foreach="${$composer.foodlistsize}"> <label value="${each.item[forEachStatus.index]}"/> </cell> </row>
</template> </grid>

This worked for me in all versions including ZK 7.0.0

link publish delete flag offensive edit

answered 2013-09-16 11:59:30 +0800

mradharani gravatar image mradharani
1

I should say thanks to the ZK framework Team who gave this solution.

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
2 followers

RSS

Stats

Asked: 2013-09-06 10:28:17 +0800

Seen: 33 times

Last updated: Sep 16 '13

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More