Skip to content

Commit

Permalink
For #156 - fixed issue with scroll bar space in grid
Browse files Browse the repository at this point in the history
  • Loading branch information
vitalidze committed Apr 28, 2015
1 parent 8394099 commit cef5f15
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
25 changes: 21 additions & 4 deletions src/main/java/org/traccar/web/client/view/UserDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@
import com.sencha.gxt.core.client.ToStringValueProvider;
import com.sencha.gxt.data.shared.ListStore;
import com.sencha.gxt.widget.core.client.form.validator.RegExValidator;
import com.sencha.gxt.widget.core.client.grid.CheckBoxSelectionModel;
import com.sencha.gxt.widget.core.client.grid.ColumnConfig;
import com.sencha.gxt.widget.core.client.grid.ColumnModel;
import com.sencha.gxt.widget.core.client.grid.Grid;
import com.sencha.gxt.widget.core.client.grid.*;
import org.traccar.web.client.ApplicationContext;
import org.traccar.web.client.i18n.Messages;
import org.traccar.web.client.model.EnumKeyProvider;
Expand Down Expand Up @@ -86,6 +83,9 @@ public interface UserHandler {
@UiField
Grid<DeviceEventType> grid;

@UiField(provided = true)
GridView<DeviceEventType> view;

@UiField(provided = true)
ColumnModel<DeviceEventType> columnModel;

Expand All @@ -95,6 +95,19 @@ public interface UserHandler {
@UiField(provided = true)
Messages i18n = GWT.create(Messages.class);

static class NoScrollbarGridView<M> extends GridView<M> {
public NoScrollbarGridView() {
this.scrollOffset = 1;
this.vbar = false;
this.setAdjustForHScroll(false);
}

@Override
protected int getScrollAdjust() {
return 0;
}
}

public UserDialog(User user, UserHandler userHandler) {
this.userHandler = userHandler;

Expand All @@ -114,6 +127,10 @@ public String getValue(DeviceEventType object) {

columnModel = new ColumnModel<DeviceEventType>(columns);

view = new NoScrollbarGridView<DeviceEventType>();
view.setAutoFill(true);
view.setStripeRows(true);

notificationEventStore = new ListStore<DeviceEventType>(new EnumKeyProvider<DeviceEventType>());
notificationEventStore.addAll(Arrays.asList(DeviceEventType.values()));

Expand Down
5 changes: 1 addition & 4 deletions src/main/java/org/traccar/web/client/view/UserDialog.ui.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@
<ui:attributes width="1" height="-1" />
</ui:with>

<ui:with type="com.sencha.gxt.widget.core.client.grid.GridView" field="view">
<ui:attributes stripeRows="true" autoFill="true" />
</ui:with>

<ui:with type="com.sencha.gxt.widget.core.client.grid.GridView" field="view" />
<ui:with type="com.sencha.gxt.data.shared.ListStore" field="notificationEventStore" />
<ui:with type="com.sencha.gxt.widget.core.client.grid.ColumnModel" field="columnModel" />

Expand Down

0 comments on commit cef5f15

Please sign in to comment.