[gradebook2-dev] Read-only cells in Gradebook

Pang, David dxp at umich.edu
Fri Sep 24 08:35:37 PDT 2010


Thanks, Mike.

I have revised the code. It works on the test load.  When the cell is clicked , the request sent to the server is disabled. So, the cell will behave like a non-editable one.

David


On 9/1/10 4:47 PM, "Jim Eng" <jimeng at umich.edu> wrote:



Begin forwarded message:

From: Michael Wenk <mjwenk at ucdavis.edu>
Date: August 30, 2010 9:07:47 PM EDT
To: Jim Eng <jimeng at umich.edu>
Cc: Thomas Amsler <tpamsler at ucdavis.edu>, gradebook2-dev at collab.sakaiproject.org
Subject: Re: [gradebook2-dev] Read-only cells in Gradebook

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


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/gradebook2-dev/attachments/20100924/8113e7b5/attachment.html 


More information about the gradebook2-dev mailing list