Checkbox in table

hi dear wd experts,
i have created a 2 coloumns table, which retrieves data from a model object. It's context is nodeUTablenodeUrowsattribute1.
the second table column contains a checkbox.
For the checkbox I set up a node, which carries a bool variable and which is assigned to the checkbox "checked" poperty.
I set the cardinality of the checkbox node 1:n (when using 0:n the checkboxes are disabled...)
During wdDoModify I create checkbox contexts like this:
wdContext.nodeStandard().invalidate();
int rsize = wdContext.nodeUrows().size();
          for (int i = rsize - 1; i >= 0; i--)
               IPrivateDealer.IStandardElement standard =
                                   wdContext.createStandardElement();
                    wdContext.nodeStandard().addElement(standard);
so I get as many bool vars as required. I am not sure about the "invalidate()" method.
I thought, when using it like above, I could also use a 0:n cardinality for my checkbox contents. But even "validate()" won't enable the checkboxes on the webpage... hence I use 1:n.
Now I set up an onToggle Event for the checkbox, which looks like this:
if(wdContext.currentStandardElement().getBolStandard()==false){
          wdContext.currentStandardElement().setBolStandard(true);
     }else{
          wdContext.currentStandardElement().setBolStandard(false);
Unfortunatly this only works for all checkboxes, and furthermore, once checked, I can't reset the checkboxes.
I also tried to use the getLeadSelection() of my nodeUrows. But this returns always 1.
<b>Big Question goes here:
How can I address only one checkbox???</b>
thanx a lot for your patience and help...
Matthias

Hi armin et al,
thanx for all the messages - i followed different different approaches. Armins for instance.
So I put a boolean var in in my modelnode which "Rows" and bound it to the checked property of the celleditor checkbox. The bool var is called "bolStandard" in my case.
Now in the "CheckBox.onToggle" event, I declared:
if(wdContext.currentUrowsElement().getBolStandard()==false){
          wdContext.currentUrowsElement().setBolStandard(true);
     }else{
          wdContext.currentUrowsElement().setBolStandard(false);
The point is, the checkbox won't check, and the leadselection of the table jumps back to the first row.
What went wrong?
I did not set up any parameters for the event, like somebody here suggested...
I also did the wdDoModify like this (in firstTime):
// checkboxen
     IWDCheckBox cb = (IWDCheckBox) view.getElement("cb");
     cb.mappingOfOnToggle().addSourceMapping("checked", "newCheckedState");
thanx once more - points will be rewarded of course to every single helpful feedback,
matthias

Similar Messages

  • Problem with checkbox on table component

    Hello i am having a problem with checkbox in table component
    i am developing something like a shopping cart app and i have a checkbox in my table component , i want users to select items from the checkbox to add to thier cart, They can select the items from cartegory combobox , my problem is when they select the items from the checkbox if they select another category the alread selected once do not display in my collection opbject please how can i maintain the state of the already selected items in my collection object

    Hi,
    Please go through the tutorial "Understanding scope and managed beans". This is available at:
    http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/scopes.html
    The details of the selected items need to be stored in an object that is in session scope.
    Hope this helps
    Cheers
    Girish

  • How to add Checkbox in Table

    Hi,
    I want to add CheckBox in Table. my requirement is multiselection. I Implemented the following steps, but it's not working. anyone can tell me,what mistake i did?
    I created two "Value Attribute"(check,Name) under a "Value Node"(Student) in context.
    check - Boolean
    Name - mapped a Dictionary simple Type(5 values)
    Include a Table in Layout and select Create Binding on right clicking of Table.
    Checked only Student and check -> Next
    Selected the Editor as checkbox -> Finish
    Selected Name from context and assigned to checkbox text property.
    Then I deployed the application. But only one checkbox is displayed in Table without any text.
    Please give me the suggestion, how to do this.
    Thanks in Advance
    Rajakumar

    Hello,
    I think you have a fundamental misunderstanding on how Checkboxes work. A Checkbox triggers a boolean value with true (checked) or false (uncheked).
    When you map your name attribut to text you will see the content of that attribute as text behind. But not the metadata.
    You may want to use a RadiobuttonGroup or CheckboxGroup for your purpose.
    Frank

  • How can i uncheck a checkbox in table component on clicking a button

    In my application I have a table component that display data from the database and a submit button outside the table component, the first column in the table component is a checkbox, How can i uncheck the checkbox in the table component when the submit button is clicked?
    Thanks in advance.

    Something like this ... I THINK it will uncheck all checkboxes in table, but I'm not positive ... you can test!
    if checkbox id is checkbox1...
    <script type="text/javascript"><![CDATA[                                         
    function disableCheckbox()
    document.getElementById('form1:checkbox1').selected = false;
    }]]></script>Put above code inside of head tag in JSP View
    NEXT...
    go to Design View and select your button and go to properties section and select onClick property and insert this javascript in dialog...
    setTimeout('disableCheckbox()', 1)Now run the project when you click the button does the checkbox become unselected?
    Anyway this is where I would start...as far as selecting just the first checkbox if there is more than 1 record...I'm not sure...but I'm curious if this works.
    Jason

  • How to add selected values from table(selected using checkbox)to table?

    Hi All,
    i have created simple page with search panel with table in table i have created one column as check box for selecting.
    here what my requirement is i need to do search multiple times to add some roles to from some different categories.here whenever i searched i ll get some roles into table there i ll select some role and i ll click add buttion. whenever i click add i need to add those roles into some other table finally i ll submit added roles.
    here i followed one link http://www.oracle.com/technetwork/developer-tools/adf/learnmore/99-checkbox-for-delete-in-table-1539659.pdf
    i used same code and able to see selected row in console, as object array how to add these into table.
    please help me out
    Thanks in advance
    siva shankar

    Thank you for a quick reply
    i used the same thing before i go for table check box concept.here what i observed is when i search i am getting some results i am able to shuttle.but if i search again the shuttle is refreshing with new values even not available list its refreshing selected list. IF dont want refresh selected ones.
    my usecase after make some searches I will select some roles from different categories at finally i ll submit.
    i hope you understand me requirement. please suggest me is this requirement is possible in shuttle component? if yes please guide me.
    thanks
    Siva Sankar

  • Problem with CheckBox as table cell renderer

    i m making a JTable having three columns.
    i m also making a cellRenderer of my own MyRenderer
    extending Jcheckbox and implementing TableCellRenderer
    now i m setting MyRenderer as renderer for third column in my table and
    DefaultCellEditor with jcheckbox as parameter as cell editor for this column
    the code is like this--------------------
    ****making of JTable****
    table= new JTable(3,3);
    JScrollPane scrollPane = new JScrollPane(table);
    TableColumn tableColumn = table.getColumn("Male"); // let us suppose that this gives third column
    tableColumn.setCellRenderer(new MyRenderer ());
    tableColumn.setCellEditor(new DefaultCellEditor(new JCheckBox()));
    *****The classs implementing TableCellRenderer is given below******
    class MyRenderer extends JCheckBox implements TableCellRenderer{
    public MyRenderer(){
    public Component getTableCellRendererComponent(JTable table, Object value,
    boolean isSelected, boolean hasFocus,
    int row, int column){
    if(value != null){
    Boolean booleanValue = (Boolean)value;
    setSelected(booleanValue.booleanValue());
    return this;
    ***********************************Problem****************************
    The problem is that when we click on the cell of that column first time,
    all the cells are selected.
    I don't want to use getColumnClass() method for this problem .
    If possible , please give some other solution.
    what is the problem behind this,If anybody can help us.
    Thanks in advance.

    I think the problem is, when the value is null the checkbox return with the selected state, b'coz u r
    returning the checkbox (as it is). so pl'z try with below code (ADDED).
    public Component getTableCellRendererComponent(JTable table, Object value,
    boolean isSelected, boolean hasFocus,
    int row, int column){
    if(value != null){
    Boolean booleanValue = (Boolean)value;
    setSelected(booleanValue.booleanValue());
    else /// ADDED
    setSelected(false);/// ADDED
    return this;
    Nediaph.

  • Checkbox in table cell won't uncheck

    Hey all,
    Can someone help with this please. I am using a table model where the second column is Boolean. The table correctly renders this as a checkbox (I'm not using a custom renderer). The checkbox works ok except that you can't uncheck it. You can change which row is selected, but clicking twice on the same cell has no effect - it just stays checked.
    Thanks in advance for any help.

    here I am giving one example. Can u check this. In this eg, I gave check box in 3rd column(column no starting from 0).
    import javax.swing.*;
    import java.awt.event.*;
    import javax.swing.event.*;
    import javax.swing.table.*;
    import java.awt.*;
    public class Class1 extends JFrame {
    JScrollPane jScrollPane1 = new JScrollPane();
    public Class1() {
    super();
    try {          
         MyTableModel model = new MyTableModel();     JTable editableTable1 = new JTable(model);     
         DefaultTableModel tblmdl = (DefaultTableModel) editableTable1.getModel();
         tblmdl.setRowCount(3);     
         tblmdl.setColumnCount(3);     
                   editableTable1.setCellSelectionEnabled(true);
         this.getContentPane().setLayout(null);
                   jScrollPane1.setBounds(new Rectangle(25, 19, 330, 180));
         this.getContentPane().add(jScrollPane1, null);
                   jScrollPane1.getViewport().add(editableTable1, null);
         addWindowListener(new WindowAdapter() {
         public void windowClosing(WindowEvent we) {
              System.exit(0);
    } catch(Exception e) {
         System.out.println("Exception in Class1:"+e);
    class MyTableModel extends DefaultTableModel {
         MyTableModel() {
         public Class getColumnClass(int c) {
         if(c == 2) {
         return Boolean.class;
         } else {
         return String.class;
    public static void main(String[] args) {
    Class1 class1 = new Class1();
    class1.setSize(400, 400);
    class1.setVisible(true);
    }

  • Valuechange listener called multiple times for checkbox in table.

    Hi All,
    I'm trying to understand how value change listeners work for checkbox components within a table column. I have a checkbox declared as below
    <af:selectBooleanCheckbox id="sbc1"
    valueChangeListener="#{pageFlowScope.classfiyBean.checkBoxValueChangeListener}"
    immediate="true"
    autoSubmit="true" />
    I notice the value change listener is called multiple times. There are 6 rows in the table within which the checkbox is a component. It is called 6 times for a change. How do I prevent this from happening as it's over writing the values of the other rows as well.
    Scenario : The page is based on a human task, so the outcome button cannot be set to Immediate = true since there are other validations on the page.
    JDev: 11.1.1.4
    Thanks
    PP

    Hi
    Please make sure that Is there any logic being implemented in WD MODIFY VIEW of view controller.
    If yes that may be the cause of your problem because WDModifyView() is being called every time u perform an action.
    or
    Try to Invalidate current context node which is bound to table UI element and actually containing data at run time. I think this node is not being refreshed. Try to refresh it in Search Button action.
    or
    Check your loop code snippet, if you implemented it anywhere.
    Mandeep Virk

  • Is it possible to use Checkboxes with Table Views?

    Hi,
    I need help with adding checkbox. Here is the detail of what I have.
    In my application page, I have the Region Definition:
    Type - SQL Query (PL/SQL Function body Returning SQL Query)
    Region Source -
    DECLARE
    l_sql VARCHAR2(50);
    BEGIN
    Call Function_One(arg1, arg2 ..) ;
    IF ( :P11_REQ = Value1 ) THEN
    l_sql := ' SELECT Col1, Col2, Col3 FROM View1 ' ;
    ELSE
    l_sql := ' SELECT Col1, Col2, Col3 FROM View2 ' ;
    END IF;
    RETURN l_sql;
    END;
    Please note:
    1. ' View1 ' and ' View2 ' are views on two tables.
    2. The checkboxes are needed to select rows from these views to be inserted into another table for further processing.
    Questions:
    1. Can Checkboxes be added to views also, or, to tables only?
    2. If checkboxes can be added to views, How can I do that to each of the rows that will be returned?
    3. Is there a way to use ' Select * FROM View1 ', and be able to add the checkbox to each of the rows ?
    Would appreciate your help.
    Vasan

    Vasan,
    I usually call a plsql function to generate the HTML when I need a custom component like that. ie: create a procedure in a package. this should give you the idea. I usually create a dynamic plsql region to call the below procedure like this
    begin
    printTableWithCheckboxes();
    endl;
    procedure printTableWithCheckboxes is
    begin
    htp.p('<table>');
    for rec in (select id, name from test) loop
    htp.p('<tr>');
    htp.p('<td><input type="checkbox" name="' || rec.name || '" value="' || rec.id || '" /> </td>');
    htp.p('</tr>');
    end loop;
    end printTableWithCheckBoxes;

  • Checkbox Within Table Control At Selection Screen

    Hello, there.
    In my selection screen (dialog) I'm using a table control which is based on an internal table.
    In that internal table I have a simple Yes/No field (declared as type XNULL for example).
    The problem is that I want it to be displayed as checkbox on the selection screen's table control and not as a simple string with size = 1 like it is..
    I hope it's clear and understood ...
    Thanks in advance,
    Rebeka

    Rebeka,
    Its very simple,
    In that field of table control just drag & drop the  checkbox.
    In Screen modules ,
    loop at itab.
    If Field = 'YES'.
    Checkbox = 'X'.
    else .
    clear checkbox.
    endif.
    endloop.
    Regards,
    TAlwinder

  • Checkboxes in table that show value

    Hello,
    I have a series of questions that I want the user to be able to answer yes or no by selecting or deselecting a checkbox. I have this working fine now, except when it is loaded again all the checkboxes are unchecked, even though some of my values are 'true'.
    I've tried setting the 'selected' property on the checkbox to a binding of the value in the table, as #{row.answer}, but that did nothing. I got it to work by using a #{row.answer == 'true'}, but then the checkbox became read only, which destroys the purpose.
    Lastly, I tried having two separate checkboxes, one that was selected by default and one that was unselected, then I set the render property to #{row.answer == 'true'} or #{row.answer == false}, respectively. This works the first time I load the page but after I submit or change sections they all show as unselected again.
    How can I get the checkboxes to reflect the current value?
    Thanks,
    -N

    Hi Frank,
    Thanks, that's exactly what I'm looking for.
    I'm getting stuck though and I can't figure out why. I got the sample application to work very easily, but when I try to adapt it to my new project it doesn't show any value for StatusAsBoolean. I tried using the same table even and it remains blank.
    Here's what I've done:
    Created an entity object for the table.
    Created a view object based on the entity and added another attribute (StatusAsBoolean) and uncheck everything, set as type Boolean and Always Updatable.
    Created a new class (SettingsViewRowImpl.java) and used the same code as in the class in the sample file.
    Created a table on the .jsp page.
    One thing I've noticed is that when I make a view object, it creates a SettingsViewImpl.java file. I tried putting the code in there but that crashes the application.
    I hope I'm not frustrating you, I've been trying really hard to get this to work and I'm sure it's a really obvious mistake.
    Thanks

  • JDeveloper 11.1.1.3: Best Practice for Checkboxes in Table

    Hi there,
    I'm having problems with checkboxes inside the table component.
    Can someone please fill me in as to what the best practice is to use checkboxes inside a table ?
    In the database, we are storing values Y and N.
    Thanks,
    Mark

    Hi Mark,
    I suppose you are talking about ADF Faces applications. If so, then I have two prefered approaches tested and used in real practice:
    *1) First approach: Create a simple converter, define it in the faces-config.xml and set it in the <af:selectBooleanCheckbox> tags' "converter" attribute, for example:*
    package mypackage;
    import javax.faces.application.FacesMessage;
    import javax.faces.component.UIComponent;
    import javax.faces.context.FacesContext;
    import javax.faces.convert.Converter;
    import javax.faces.convert.ConverterException;
    public class BooleanYNConverter implements Converter {
      public BooleanYNConverter() {
      public Object getAsObject(FacesContext facesContext, UIComponent uiComponent, String string) {
        if (string==null) return null;
        String s = string.trim();
        if (s.length()==0) return null;
        if (s.equalsIgnoreCase("true")) return "Y";
        if (s.equalsIgnoreCase("false")) return "N";
        FacesMessage errorMessage = new FacesMessage(FacesMessage.SEVERITY_ERROR,
            "Cannot convert " + string + " to Y/N. It must be either true or false",
            "Cannot convert " + string + " to Y/N. It must be either true or false" );
        throw new ConverterException(errorMessage);
      public String getAsString(FacesContext facesContext, UIComponent uiComponent, Object object) {
        if (object == null) return "";
        if (object.equals("Y")) return "true";
        if (object.equals("N")) return "false";
        FacesMessage errorMessage = new FacesMessage(FacesMessage.SEVERITY_ERROR,
            "Cannot convert " + object + " to true/false. It must be either Y or N",
            "Cannot convert " + object + " to true/false. It must be either Y or N" );
        throw new ConverterException(errorMessage);
    }In faces-config.xml:
      <converter>
        <converter-id>BooleanYNConverter</converter-id>
        <converter-class>mypackage.BooleanYNConverter</converter-class>
      </converter>In JSF page:
    <af:selectBooleanCheckbox ... converter="BooleanYNConverter"/>
    N.B. If you use this approach, the ViewObject attribute's Control Type should be set to "Default" instead of "Checkbox" (see the attribute's Control Hints section in the dialog box)!
    *2) Second approach: In the PageDef define a button binding for Y/N values and map the corresponding item in the table binding to this button binding. In this way you will remap VO attribute's Y/N value to true/false as how the checkbox component expects it. Neither converters nor additional configuration is necessary, but you have to do this on each checkbox field again:*
    <?xml version="1.0" encoding="UTF-8" ?>
    <pageDefinition xmlns="http://xmlns.oracle.com/adfm/uimodel" version="11.1.1.56.60" id="TestPagePageDef" Package="view.pageDefs">
      <parameters/>
      <executables>
        <variableIterator id="variables"/>
        <iterator Binds="DeptViewRO" RangeSize="25" DataControl="AppModuleDataControl" id="DeptViewROIterator"/>
      </executables>
      <bindings>
        <tree IterBinding="DeptViewROIterator" id="DeptViewRO">
          <nodeDefinition DefName="model.DeptViewRO" Name="DeptViewRO0">
            <AttrNames>
              <Item Value="DeptID"/>
              <Item Value="DeptName"/>
              <Item Value="Flag" Binds="MyFlag"/>
            </AttrNames>
          </nodeDefinition>
        </tree>
        <button IterBinding="DeptViewROIterator" StaticList="true" id="MyFlag">
          <AttrNames>
            <Item Value="Flag"/>
          </AttrNames>
          <ValueList>
            <Item Value="Y"/>
            <Item Value="N"/>
          </ValueList>
        </button>
      </bindings>
    </pageDefinition>In the sample above the target VO attribute is called Flag. Have a look at the line <tt><Item Value="Flag" Binds="MyFlag"/></tt>. This line does the magic.
    Hope I've been a bit helpful.
    Dimitar
    Edited by: Dimitar Dimitrov on Nov 13, 2010 1:53 PM
    There was a little mistake: Instead of BooleanYNConverter I had written BooleanYNCheckbox in the <af:selectBooleanCheckbox> tag.

  • Hot to display checkbox in table control

    hi all,
    i am displaying table comtrol. in my table control i have one field,name of the field is Inactive. in this field i have to show chckboxes.
    anybody can send me the code please.
    thanks,
    maheedhar.t

    Hi,
    If you want to display a field of type c as checkbox in tablecontrol.
    After opening screen painter, click the option ChkB for that field while getting the fields from Dictionary/Program Fields -> Get From Program.
    Now drag the box on to your table control.
    <u><i><b>Chk this demo program: DEMO_DYNPRO_TABCONT_LOOP_AT
    & RSDEMO02.</b></i></u>
    <u><i><b>Another way:</b></i></u>
    Go to the edit mode of the screen select the table control column you want to make it as check box and follow the menu EDIT->CONVERT->check box.
    (make sure that column definition in itab/ddtab is of size 1 char)
    regards
    navjot
    Message was edited by:
            navjot sharma

  • Web Dynpro ABAP: How to do checkboxes in table column?

    Hi,
    In Web Dynpro for ABAP, I have a table, where one column consists of check boxes, and the user should be able to check some boxes in some lines. In the context of my view, I created a node tied to a DDIC structure, with some attributes. The attribute where I want to see the checkboxes is of type boolean. In the layout I create an element of type table. Then I create the binding to the context node and for the columns I use cell editor of the appropriate type, that is, checkbox. However, when I test my application, there are no checkboxes at all. What am I doing wrong?
    Thanks,
    Ira

    >
    Jenny Karunakaran wrote:
    > Hi Jung,
    >
    > Thanks for the reply. But I dont know how to assign value set to this attribute(i.e. Context atribute to which filter value property is bound). Can I use a supply function for this ?
    >
    >
    > Regards,
    > Jenny
    No. A value set and a supply function are two completely different things. You use this Context API to populate the value set for an attribute:
    IF_WD_CONTEXT_NODE_INFO=>SET_ATTRIBUTE_VALUE_SET
    Value Sets are also how ByKey UI elements (like the DropDownByKey) are built.  Here is a help document that discusses value sets - but in the context of the ByKey UI elements.  The process is the same for creating the value set however:
    http://help.sap.com/saphelp_nw70ehp1/helpdata/en/bb/69b441b0133531e10000000a155106/frameset.htm

  • How to use CheckBox in Table to do mulit-selection in Creator2 Update1?

    Hi.
    I put CheckBox(checkbox1) into Table to do a multi-selection effect..
    and I set checkbox1's selected to true to make default selection.
    however checkbox1 doesn't show selected in at Design Time in Creator2 , and also at Runtime in Firefox.
    then I put another CheckBox(checkbox2) outside the Table, and set selected to ture.
    chekcbox2 is default selected both in Designtime and Runtime.
    I am confused about that
    And, more troubles is, I can't know which Row datas were checked.
    I call CheckBox.getSelected(checkbox1.getID()) got NULL.
    I call checkbox1.getSelected() got NULL.
    Then I write a TableDataProvider to handle this Table and always return Boolean.TRUE at selection field
    But still no work.
    Does anyone know how to do multi-selection in Table?
    Thanks a lot.

    Hi,
    I also test RadioBox in Table and set RadioBox named 'rbSelection' , the table is bind to a dataprovider.
    But, It does't work, too.
    I can't get the selection from any API I know in a Button action (outside of Table)
    RadioButton.getSelected(rbSelection.getName())) return null
    rbSelection.getSelectedValue() return true
    rbSelection.getSelected()) return null
    rbSelection.getSubmittedValue()) return null
    tableRowGroup1.getSelectedRowKeys().length size is 0
    But when I use ((HttpServletRequest)this.getFacesContext().getExternalContext().getRequest()).getParameter("rbSelection")
    I can get the correct selection result.
    Is this a Creator2 bug or my mistake?
    THANKS~

Maybe you are looking for