[gradebook2-dev] Read-only cells in Gradebook

Michael Wenk mjwenk at ucdavis.edu
Mon Aug 30 18:07:47 PDT 2010


Actually, I noticed a problem after I sent the email.  It basically kills
the grid, so clicking on students don't work.

So I tried another tactic.  I decided to go with events.
I added:


grid.addListener(Events.BeforeEdit, new Listener<GridEvent>() {

public void handleEvent(GridEvent be) {
if (isReadOnly)
{
be.setCancelled(true);
}
 }
});

to addGrid in the MGCP class.

I also added a global isReadOnly as well.  When isReadOnly is set, it will
kill of the edits.  Now to your question on a cell by cell basis, the answer
is I suspect so.  On GridEvent there's a getter for its column index and row
index.  You can use that and the grid to do what you want.  An example of
this is killing the editor for everything but the grade override.  Here's
the event handler:

grid.addListener(Events.BeforeEdit, new Listener<GridEvent>() {

public void handleEvent(GridEvent be) {
 ColumnConfig myCm =
be.getGrid().getColumnModel().getColumn(be.getColIndex());
if (isReadOnly)
{
if (!"Grade Override".equals(myCm.getHeader()))
{
be.setCancelled(true);
}
}
 }
});


Hope this helps,
Mike


On Mon, Aug 30, 2010 at 5:50 PM, Jim Eng <jimeng at umich.edu> wrote:

> Thanks, Mike.  Sounds like that might do it, but let me ask another
> question or two.  Is it possible to disable events on a cell-by-cell basis?
>  For example, in the grid, the cells containing students' names are
> read-only.  Is that because they have events disabled?  Or is something else
> done in that case?
>
> Jim
>
>
> On Aug 30, 2010, at 8:28 PM, Michael Wenk wrote:
>
> Are you thinking of disabling all edits for the grid?  Or on a item by item
> basis?
>
> If its the first, then a good way to do so would be to call
> grid.disableEvents(true) to stop it, and then grid.disableEvents(false) to
> turn it back on.
>
> Mike
>
> On Mon, Aug 30, 2010 at 3:29 PM, Jim Eng <jimeng at umich.edu> wrote:
>
>> Hi Thomas,
>>
>> I talked with David Pang today about the remaining work on GRBK-483.  In
>> our meeting several weeks ago, it sounded like you or someone else at Davis
>> might have a simple fix for one problem David described.  That is setting
>> cells to read-only when they are displaying percentages instead of points.
>>  David's work introduces a button that toggles the entire spreadsheet view
>> between displaying percentages and displaying points.  When displaying
>> percentages, it should not be possible to change the values that are
>> displayed.  Can you suggest how to accomplish that?
>>
>> Thanks.
>>
>> Jim
>> _______________________________________________
>> gradebook2-dev mailing list
>> gradebook2-dev at collab.sakaiproject.org
>> http://collab.sakaiproject.org/mailman/listinfo/gradebook2-dev
>>
>
>
>
> --
> Michael Wenk
> mjwenk at ucdavis.edu
>
>
>


-- 
Michael Wenk
mjwenk at ucdavis.edu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/gradebook2-dev/attachments/20100830/81ce9385/attachment.html 


More information about the gradebook2-dev mailing list