• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: AjaxGrid single row select UPDATE
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AjaxGrid single row select UPDATE


  • Subject: Re: AjaxGrid single row select UPDATE
  • From: Timothy Worman <email@hidden>
  • Date: Wed, 07 May 2014 19:13:04 -0700

Jens:

I’ve implement a SingleSelectionAjaxGrid that extends AjaxGrid. Actually, it’s twice removed. :-) Anyway, I don’t think there’s any major changes in the parent class. There’s a class variable for selectedObject and the following override below ’toggleSelectionOfRow.’ The component has a api binding for selectedObject.

/**
* Toggles inclusion of row into selectedObjects() (i.e. selects and
* de-selects it). This component can only have one selected row.
*/
public WOActionResults toggleSelectionOfRow() {
//row was already selected
boolean _rowWasPreviouslySelected = (selectedObjects() != null && selectedObjects().contains(row())); 
selectedObjects().removeAllObjects();
if (! _rowWasPreviouslySelected) {
setSelectedObject(row());
selectedObjects().addObject(row());
} else {
setSelectedObject(null);
}
return null;
}

Also, in the wod, the tr for the row repetition has been updated as below. This allows you to click anywhere in the tr to select.

TableRowAndToggler: AjaxUpdateLink {
action = toggleSelectionOfRow;
updateContainerID = configurationData.updateContainerID; // VALID
id = toggleRowSelectionID;
elementName = "tr";
class = rowClass;
style = rowStyle;
}

Hopefully, this helps you out.

Tim
UCLA GSE&IS


On May 7, 2014, at 9:15 AM, Chuck Hill <email@hidden> wrote:

Hi Jens,

On 2014-05-07, 1:59 AM, "Dipl.-Ing. Jens Lünstedt" wrote:

Hello,
for my AjaxGrid I have two questions. (I'm not very familiar with _javascript_)
How to define a single row selection? (At the moment I can select and deselect multiple rows).

You mean that you want to prevent the user from selecting more than one row?  It does not support that.  You probably could in _javascript_, but this is probably the wrong UI for what you are doing.


How can I react on the selection and deselection event in my Java Class? The setSelectedObjects method is not called.

You can’t directly, AjaxGrid does that.  

I think what you want is to have a link or button in each row that does something when activated.  Otherwise you are trying to bend AjaxGrid to do something it was not intended for.  Neither you nor your users are likely to be happy.

First you need a grid configuration like this:
 *            {
 *                title =  &quot;Actions&quot;;
 *                keyPath = &quot;&quot;;                       // Missing or empty keypath results in the current object itself being passed to component
 *                component = &quot;EmployeeActions&quot;;      // Name of WOComponent to be displayed in this column.  Gets passed two bindings: value (Object), 
 *                                                              // and grid (AjaxGrid) so that any other needed data can be accessed
 *                cssClass = &quot;alignCenter&quot;;
 *            }

Then in the component some simple HTML like:
<span style="float:middle"><WEBOBJECT NAME="Remove"/></span>

Then use a regular link or an Ajax one, depending on what you want to happen:
Remove: WOHyperlink {
    action = remove;
    string = "Remove";
}

And implement the action method to do what you want.


Chuck




I can't find a description / example in the web.

Thanks
Jens

UPDATE: I found a solution in checking the change of selectedObjects in public WODisplayGroup displayGroup()
I don't know if that is a good solution but it works.
Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Re: AjaxGrid single row select UPDATE (From: Chuck Hill <email@hidden>)

  • Prev by Date: Re: AjaxGrid single row select UPDATE
  • Next by Date: ERPDFGeneration problem
  • Previous by thread: Re: AjaxGrid single row select UPDATE
  • Next by thread: ERPDFGeneration problem
  • Index(es):
    • Date
    • Thread