Hi Jason,
on further investigation I see that I have made a mistake. The  previous code snippet should have read:

if(java.lang.Boolean.TRUE.equals(row.lookupWidget("delete").value)) {
  itemsToDelete.add (row.lookupWidget("id").value); //add item to delete
  deleteOrderItem2(itemsToDelete);
                        
  //now delete item row from repeater
                         
}

Once I have the itemID I add it to the vector and send that to my delete orderItem function. What I then want to do is to delete the actual row from the table associaated with the orderItem ID. How do I do that in flow? I also have a snippet which handles adding orderItems:

                if (parseInt(bizData.quantity)) { //Add a row if need be
                    //add a row and an item to the orderitem
                    addOrderItem(bizData.quantity, bizData.orderID, bizData.stockID );
                   
                    //Now add this item to the repeater
               }


and again, once the orderitem object has been updated I now want to add that item to the repeater. I tried:

                   //Now add this item to the repeater
                   form.lookupWidget ('items')
                   .addRow()
                   .getChild('id').value = orderitem.getID() 
                  
.getChild('artistName').value = orderitem.getArtistName()
                  
.getChild('itemTitle').value = orderitem.getStock().getItemTitle()
                  
.getChild('amount').value = orderitem.getAmount()
                   .
getChild('price').value = orderitem.getPrice()

but get an '
TypeError: getChild is not a function.'

So how do I do also add a row item to a repeater from within flow?

regards

Andrew

On 25/07/06, Andrew <[EMAIL PROTECTED]> wrote:
Hi Jason,
first off I have to say I appreciate the time you put into helping me grasp these concepts, much appreciated.

Ok, so I have in jx file:

                      <ft:repeater-rows>

                      <tr>
                        <td width="8" class="normaltext"></td>
                        <td class="normaltext"><ft:widget id="id" /></td>

                        <td width="8" class="normaltext"></td>
                        <td class="normaltext"><ft:widget id="artistName" /></td>

                        <td width="8" class="normaltext"></td>
                        <td class="normaltext"><ft:widget id="itemTitle" /></td>
                        <td class="normaltext"></td>
                        <td class="normaltext"><ft:widget id="amount" /></td> 
                        <td class="normaltext"></td>
                        <td class="normaltext"><ft:widget id="price" />.00</td>
                        <td class="normaltext"></td>
                        <td class="normaltext"><ft:widget id="delete" /></td>               
                      </tr>
                      </ft:repeater-rows>

and in my validation:

    <fd:repeater id="items" initial-size="0">

          <fd:widgets>
            <fd:output id="id">
                  <fd:datatype base="string" />

            </fd:output>
            <fd:output id="artistName">
                  <fd:datatype base="string" />
            </fd:output>
            <fd:output id="itemTitle">

                  <fd:datatype base="string" />
            </fd:output>
            <fd:output id="amount">

                  <fd:datatype base="string" />
            </fd:output>
            <fd:output id="price">

                  <fd:datatype base="string" />
            </fd:output>
            <fd:booleanfield id="delete" />
          </fd:widgets>
    </fd:repeater>

and in my flow:

                if (repeaterSize != 0) { //Delete a row if need be
                    //delete a row and an item from the orderitem

                    for(var i=0; i < repeater.getSize(); i++) { //loop over the rows
                      var row = repeater.getRow(i);
                      if( java.lang.Boolean.TRUE.equals(row.lookupWidget ("delete").value)) { //is the booleanfield checked?
                        itemsToDelete.add(row.lookupWidget("id").value); //add the item id to delete from widget
                       
                        //now delete item from orderitems object
                        items.add(row.lookupWidget("id").value);
                        deleteOrderItem2(items);
                      }
                    }
                  
                }
              
                if (parseInt(bizData.quantity)) { //Add a row if need be
                    //add a row and an item to the orderitem
                    addOrderItem(bizData.quantity, bizData.orderID , bizData.stockID);
                   
                   // add values to repeater widgets, and then add row to repeater-rows
                }

So how in flow do I add values to each of the widgets, (id, artistName, etc etc etc), in the repeater, and then add that row to <ft:repeater-rows>?

regards

Andrew


On 25/07/06, Jason Johnston < [EMAIL PROTECTED]> wrote:
Jason Johnston wrote:
> var itemsToDelete = new java.util.Vector();
> var repeater = form.lookupWidget("items");
> for(var i=0; i<repeater.getSize(); i++) { //loop over the rows
>   var row = repeater.getRow(i);
>   if(row.lookupWidget("delete").value) { //is the booleanfield checked?

Small correction... the above line should probably be something more like:

if(java.lang.Boolean.TRUE.equals (row.lookupWidget("delete").value)) {

Datatype conversion between Java and JS can be tricky at times. ;-)


>     itemsToDelete.add(row.lookupWidget("id").value); //add the item id
>   }
> }
>

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



Reply via email to