I'd like to propose enhancement which makes it easier to define which
columns are sorted.

The grid component, as of 5.0.11, by default applies and enables
sorting to all columns. If one wants to change it, one must give grid
the model via "model" parameter. In the spirit of recently changed
default grid behavior ("include" parameter rather then "remove", and
"add" parameter which saves the need to mess with the model when
adding new columns), I'm wondering if similar evaluation (and possibly
change) of current sort defaults makes sense at this time.

What I'm proposing is a very unintrusive way to define which columns
are sortable. This does two things: allows to easily and quickly
define which columns are sortable via the markup, and removes the need
to work with model in page class. Do you folks find yourself disabling
sort most of the time only to seldom enable it for a column here and
there? Currently one must get the model, define sort, and expose it so
that it can be passed onto grid:

@Inject
private BeanModelSource _beanModelSource;
        
@Inject
private ComponentResources _componentResources;

private BeanModel<someclass> _model;

@OnEvent("activated")
void disableGridSort() {
 _model = _beanModelSource.create(someclass,  false, _componentResources);
 for(String property : _model.getPropertyNames())
  _model.get(property).sortable(false);
}

public BeanModel getModel() {
 return _model;
}

That's a lot of code for something that could be handled within the
template. Would't it be easier if we could do something along those
lines:

<t:grid t:source="articles" rowsPerPage="10" pagerPosition="bottom"
include="id*,text,author*,publishedDate" row="article"/>

The only new syntax is the star appended to column names in the
include parameter. If the column has a star appended, then it is to be
sortable so the grid should only enable sort on columns suffixed with
the star. If, on the other hand no column is suffixed with the star:

<t:grid t:source="articles" rowsPerPage="10" pagerPosition="bottom"
include="id,text,author,publishedDate" row="article"/>

then grid operates just as it does today, enabling sort on all
columns, which gives a nice backward compatibility.

I'd be happy to submit JIRA for this improvement, if I'm not the only
one who thinks this would be nice.

Regards,
-adam

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to