How do I delete multiple rows from datagrid?

Hi,
I have a datagrid which has an item renderer on the 1st column which displays a checkbox. I wish to delete all the rows of data from my datagrid which have the checkbox selected.
I'd be very grateful if anyone can anyone help me with this.
Thanks in advance,
Xander

Test this:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="init()" layout="vertical" xmlns:components="components.*">
    <mx:Script>
        <![CDATA[
            import mx.collections.ArrayCollection;
            [Bindable]
            private var dp:ArrayCollection;
            private function init():void
                var sa:Array = [{selected: false, value: "Some value"}, {selected: true, value: "Some other value"}];
                dp = new ArrayCollection(sa);
            private function handleDelete():void
                var na:Array = dp.source.filter(function callback(item:*, index:int, array:Array):Boolean
                            return item.selected == false;
                dp.source = na;
        ]]>
    </mx:Script>
    <mx:DataGrid dataProvider="{dp}">
        <mx:columns>
            <mx:DataGridColumn headerText="Column 1" dataField="selected">
                <mx:itemRenderer>
                    <mx:Component>
                        <mx:CheckBox selected="{data.selected}" click="data.selected = event.target.selected"/>
                    </mx:Component>
                </mx:itemRenderer>
            </mx:DataGridColumn>
            <mx:DataGridColumn headerText="Column 2" dataField="value"/>
        </mx:columns>
    </mx:DataGrid>
    <mx:Button label="Delete selected" click="handleDelete()"/>
</mx:Application>
Dany

Similar Messages

  • Best practice for deleting multiple rows from a table , using creator

    Hi
    Thank you for reading my post.
    what is best practive for deleting multiple rows from a table using rowSet ?
    for example how i can execute something like
    delete from table1 where field1= ? and field2 =?
    Thank you

    Hi,
    Please go through the AppModel application which is available at: http://developers.sun.com/prodtech/javatools/jscreator/reference/codesamples/sampleapps.html
    The OnePage Table Based example shows exactly how to use deleting multiple rows from a datatable...
    Hope this helps.
    Thanks,
    RK.

  • How to delete multiple rows from ADF table

    How to delete multiple rows from ADF table

    Hi,
    best practices when deleting multiple rows is to do this on the business service, not the view layer for performance reasons. When you selected the rows to delete and press submit, then in a managed bean you access thetable instance (put a reference to a managed bean from the table "binding" property") and call getSeletedRowKeys. In JDeveloper 11g, ADF Faces returns the RowKeySet as a Set of List, where each list conatins the server side row key (e.g. oracle.jbo.Key) if you use ADF BC. Then you create a List (ArrayList) with this keys in it and call a method exposed on the business service (through a method activity in ADF) and pass the list as an argument. On the server side you then access the View Object that holds the data and find the row to delte by the keys in the list
    Example 134 here: http://blogs.oracle.com/smuenchadf/examples/#134 provides you with the code
    Frank

  • Deleting Multiple Rows From Multiple Tables As an APEX Process

    Hi There,
    I'm interesting in hearing best practice approaches for deleting multiple rows from multiple tables from a single button click in an APEX application. I'm using 3.0.1.008
    On my APEX page I have a Select list displaying all the Payments made and a user can view individual payments by selecting a Payment from the Select List (individual items are displayed below using Text Field (Disabled, saves state) items with a source of Database Column).
    A Payment is to be deleted by selecting a custom image (Delete Payments Button) displayed in a Vertical Images List on the same page. The Target is set as the same page and I gave the Request a name of DELETEPAY.
    What I tried to implement was creating a Conditional Process On Submit - After Computations and Validations that has a source of a PL/SQL anonymous block as follows:
    BEGIN
    UPDATE tblDebitNotes d
    SET d.Paid = 0
    WHERE 1=1
    AND d.DebitNoteID = :P7_DEBITNOTEID;
    INSERT INTO tblDeletedPayments
    ( PaymentID,
    DebitNoteID,
    Amount,
    Date_A,
    SupplierRef,
    Description
    VALUES
    ( :P7_PAYMENTID,
    :P7_DEBITNOTEID,
    :P7_PAID,
    SYSDATE,
    :P7_SUPPLIERREF,
    :P7_DESCRIPTION
    DELETE FROM tblPayments
    WHERE 1=1
    AND PaymentID = :P7_PAYMENTID;
    END;
    The Condition Type used was Request = Expression 1 where Expression 1 had a value of DELETEPAY
    However this process is not doing anything!! Any insights greatly appreciated.
    Many thanks,
    Gary.

    ...the "button" is using a page level Target,...
    I'm not sure what that means. If the target is specified in the definition of a list item, then clicking on the image will simply redirect to that URL. You must cause the page to be submitted instead, perhaps by making the URL a reference to the javaScript doSubmit function that is part of the standard library shipped with Application Express. Take a look at a Standard Tab on a sample application and see how it submits the page using doSubmit() and emulate that.
    Scott

  • How do I insert multiple rows from a single form ...

    How do I insert multiple rows from a single form?
    This form is organised by a table. (just as in an excel format)
    I have 20 items on a form each row item has five field
    +++++++++++ FORM AREA+++++++++++++++++++++++++++++++++++++++++++++++++++++
    +Product| qty In | Qty Out | Balance | Date +
    +------------------------------------------------------------------------+
    +Item1 | textbox1 | textbox2 | textbox3 | date +
    + |value = $qty_in1|value= &qty_out1|value=$balance1|value=$date1 +
    +------------------------------------------------------------------------+
    +Item 2 | textbox1 | textbox2 | textbox4 | date +
    + |value = $qty_in2|value= $qty_out1|value=$balance2|value=$date2 +
    +------------------------------------------------------------------------+
    + Item3 | textbox1 | textbox2 | textbox3 | date +
    +------------------------------------------------------------------------+
    + contd | | | +
    +------------------------------------------------------------------------+
    + item20| | | | +
    +------------------------------------------------------------------------+
    + + + SUBMIT + ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    Database Structure
    +++++++++++++++++
    + Stock_tabe +
    +---------------+
    + refid +
    +---------------+
    + item +
    +---------------+
    + Qty In +
    +---------------+
    + Qty Out +
    +---------------+
    + Balance +
    +---------------+
    + Date +
    +++++++++++++++++
    Let's say for example user have to the use the form to enter all 10 items or few like 5 on their stock form into 4 different textbox field each lines of your form, however these items go into a "Stock_table" under Single insert transaction query when submit button is pressed.
    Please anyone help me out, on how to get this concept started.

    Hello,
    I have a way to do this, but it would take some hand coding on your part. If you feel comfortable hand writing php code and doing manual database calls, specificaly database INSERT calls you should be fine.
    Create a custom form using the ADDT Custom Form Wizard that has all the rows and fields you need. This may take a bit if you are adding the ability for up to 20 rows, as per your diagram of the form area. The nice thing about using ADDT to create the form is that you can setup the form validation at the same time. Leave the last step in the Custom Form Wizard blank. You can add a custom database call here, but I would leave it blank.
    Next, under ADDT's Forms Server Behaviors, select Custom Trigger. At the Basic tab, you enter your custom php code that will be executed. Here you are going to want to put your code that will check if a value has been entered in the form and then do a database INSERT operation on the Stock_table with that row. The advanced tab lets you set the order of operations and the name of the Custom Trigger. By default, it is set to AFTER. This means that the Custom Trigger will get executed AFTER the form data is processed by the Custom Form Transaction.
    I usually just enter TEST into the "Basic" tab of the Custom Trigger. Then set my order of operations in the "Advanced" tab and close the Custom Trigger. Then I go to the code view for that page in Dreamweaver and find the Custom Trigger function and edit the code manually. It's much easier this way because the Custom Trigger wizard does not show you formatting on the code, and you don't have to keep opening the Wizard to edit and test your code.
    Your going to have to have the Custom Trigger fuction do a test on the submitted form data. If data is present, then INSERT into database. Here's a basic example of what you need to do:
    In your code view, the Custom Trigger will look something like this:
    function Trigger_Custom(&$tNG) {
    if($tNG->getColumnValue("Item_1")) {
    $item1 = $tNG->getColumnValue("Item_1");
    $textbox1_1 = $tNG->getColumnValue("Textbox_1");
    $textbox1_2 = $tNG->getColumnValue("Textbox_2");
    $textbox1_3 = $tNG->getColumnValue("Textbox_3");
    $date1 = $tNG->getColumnValue("Textbox_3");
    $queryAdd = "INSERT INTO Stock_table
    (item, Qty_In, Qty_Out, Balance, Date) VALUES($item1, $textbox1_1, $textbox1_2, $textbox1_3, $date1)"
    $result = mysql_query($queryAdd) or die(mysql_error());
    This code checks to see if the form input field named Item_1 is set. If so, then get the rest of the values for the first item and insert them into the database. You would need to do this for each row in your form. So the if you let the customer add 20 rows, you would need to check 20 times to see if the data is there or write the code so that it stops once it encounters an empty Item field. To exit a Custom Trigger, you can return NULL; and it will jump out of the function. You can also throw custom error message out of triggers, but this post is already way to long to get into that.
    $tNG->getColumnValue("Item_1") is used to retrieve the value that was set by the form input field named Item_1. This field is named by the Custom Form Wizard when you create your form. You can see what all the input filed names are by looking in the code view for something like:
    // Add columns
    $customTransaction->addColumn("Item_1", "STRING_TYPE", "POST", "Item_1");
    There will be one for each field you created with the Custom Form Wizard.
    Unfortunately, I don't have an easy way to do what you need. Maybe there is a way, but since none of the experts have responded, I thought I would point you in a direction. You should read all you can about Custom Triggers in the ADDT documentation/help pdf to give you more detailed information about how Custom Triggers work.
    Hope this helps.
    Shane

  • How do I delete multiple photos from library?

    Hi All
    On my iphone - how do I delete multiple photos from the library without having to do 1 at a time?
    Thanks

    In the album, tap on the little forward arrow in the upper right corner. From there you can tap as many photos as you'd like, and at the bottom, you'll have the options to Share, Copy, Add To, or Delete.

  • How do I delete multiple emails from my gmail account on my iPad?

    How do I delete multiple emails from my gmail account on my iPad?

    While looking at your inbox on the left, tap Edit and then tap the circle next to each email you want to delete then hit the trash can icon.

  • How do I delete multiple photos from the Camera Roll?

    How do I delete multiple photos from camera roll without doing it one at a time?

    Thanks for your posts on this - it's something I've been wondering about, too.
    I do agree with Bonzo that it seems strange that there isn't a way to do it *efficiently* without having to hook the iPad to a computer.
    I know there is an alternative: in other words, you're right, Lawrence - it is possible to delete multiple files at once by following your instructions (i.e. tapping on each photo once, etc.) - but if you want to delete lots of photos, it takes ages to tap on every one of them.
    Does anyone else out there know of a way to delete multiple photos on the iPad/iPhone/iPod touch without having to tap on each photo separately, or having to hook up to a computer?
    I'd be really grateful for any help on this. Thanks!

  • TS3899 how can i delete multiple emails from my IPhone 5C from the inbox?

    How can i delete multiple emails from my inbox from my IPhone 5c?

    Use command-click to select multiple messages, one at a time.  Use shift-click to select a contiguous set of messages (just like in the Finder).  Then press the delete key.

  • How do i delete multiple rows in JTable

    hello
    how i delete multiple rows in JTable
    when i selected multiple rows from the jtable and delete its give the error ArrayIndexOutOfBoundException
    e.g.
    int rows[]=jtable.getSelectedRows();
    for(int i=0;i<rows.length;i++)
    DefaultTableModel model=(DefaultTableModel)jtable.getModel();
    model.removeRow(rows);
    like this
    please help me
    meraj

    You are trying to remove the rows an equal times to the amount of rows selected.
    You should remove one row at a time:
    model.removeRow(rows);
    Change your code into this.
    for(int i=0;i<rows.length;i++)
    DefaultTableModel model=(DefaultTableModel)jtable.getModel();
    model.removeRow(rows[i]);

  • Deleting multiple rows from SUD dialog table

    Hi,
    I have some SUD dialog tables that I would like to delete some rows from.  I can select and delete all or one row (using a SUD button that finds out which one row was selected or if all, and then deleting them with the table.rows.remove command), but I seem to have troubles if I want to select multiple rows (either in a range, ex: rows 3-10, or non-sequential, ex: 1, 4, 6 and 23).  I just started working on this but thought maybe someone has already done this and can save me the trouble!
    Thanks!
    Julia Moeller

    Hi Julia,
    Just a quick guess-- try looping backwards and deleting the last rows first:
    FOR i = 10 TO 3 Step -1
      table.rows.remove i
    NEXT
    Haven't tested it, so no guarantees,
    Brad Turpin
    DIAdem Product Support Engineer
    National Instruments

  • How do you delete multiple emails from your "inbox" w/o clicking on each one individually?

    How do you delete multiple inbox emails to trash w/o clicking on each one individually?

    Highlight one. Click edit. Click "mark all" at the bottom. Click trash.
    Barry

  • DELETE MULTIPLE ROWS FROM MATRIX

    Hi all,
    I´M DESPERATED.
    I am able to delete row by row in my matrix, but ¿Could anyone post a sample to delete multiple rows?
    I´ve been trying several ways but it doesn´t work.
    My code is:
    ========================
      Dim i As Long = oMatrix.GetNextSelectedRow
                    If i > -1 Then
                        If oMatrix.IsRowSelected(i) = True Then
                            oMatrix.DeleteRow(i)
                        End If
    ========================
    Thank you in advanced,
    lorenzo

    Don´t worry, It was a problem with my loop.
    Thanks anyway
    lorenzo

  • How to pass out multiple rows from EJB method?

    I need a sample for passing multiple rows from a EJB query method
    (using SQLJ). All I found in existing sample code is query on a
    single row and pass out as a bean class e.g Emp class with some
    getXX() method.
    What I'm currently doing is to convert the Iterator to a Vector
    and pass the Vector out, which means I've to code a bean class,
    use a Vector and later use a Enumeration to read the result. Is
    there a simpler way to receive multiple rows from EJB?
    In EJB:
    while ( empIter.next() ) {
    EmpVect.addElement( new Emp( emps.empNo(), emps.eName(),
    emps.job(), emps.deptNo()) );
    return EmpVect;
    In client:
    Vector empVect = empEJB.getEmployees(123);
    Enumeration employees = empVect.elements();
    while ( employees.hasMoreElements() ) {
    emp = ( Emp ) employees.nextElement();
    System.out.println(" " + emp.getEName());

    Hi Ankit,
    There is a workarround that requires some excel work.
    Here you need to follow the above mentioned steps along with this you need an additional combo box (wont be displayed at runtime, it will fetch the entire data if we select blank for the first combo box).
    Now suppose we are using 2 combobox C1 and C2 and our data is from B3 to F6.
    Now for C1 (one we are using for selection)
    1. select the labels as Sheet1!$B$2:$B$6 (a blank cell is added for all selection)
    2. Insertion type as filtered Rows
    3. Take source data as Sheet1!$B$2:$F$6 (includeing one blank row)
    4. selected Items as none
    5. for C2 labels as Sheet1!$A$3:$A$6 source data as Sheet1!$B$3:$F$6 destination as Sheet1!$B$14:$F$17.
    6. Selected Item : Sheet1!$B$9  (blank  Type dynamic). So it will select the entire table, if nothing is selected.
    7. take a Grid component and map it to Sheet1!$H$9:$L$12. use formula as =IF(IF($B$9="",B14,B9)=0,"",IF($B$9="",B14,B9)) on cell H9. Where we take H6 to L12 as final data set. Tis will become the data for next set fo Combo box for further selection.
    8. follow the same steps for other combobox selections.
    9. control the dynamic visibility of grids on the basis of Destination cell (like B9).
    Revert if you need further clarification.
    Regards,
    Debjit

  • How do I delete multiple rows and columns in an image?

    I am looking into how digital SLRs extract video data from a CMOS sensor. To give an example, the GH1 from Panasonic can record video at 1920 x 1080 from a 12 MPixel sensor that, say, is 4000 horizontal x 3000 vertical. How they do that seems to be not in the public domain, but there have been a few guesses (see http://www.dvxuser.com/V6/showthread.php?t=206797 and http://luminous-landscape.com/forum/index.php?showtopic=38713).
    One approach would be to simply read every second row of sensor pixels (1500 rows read from the original 3000) and once you have those in memory, delete every second column (2000 columns left). You would end up with a 2000 x 1500 image which could then be resampled to 1920 x 1080.
    I'd like to simulate what the camera appears to be doing, by generating a 4000 x 3000 test image and then asking Photoshop CS4 to delete the appropriate rows and columns. It may not necessarily be every second row; the Canon 5DMk11 appears to read every third row, so I may need to delete two out of every three rows.
    Can Photoshop do that sort of thing? If so, how?

    Thanks for the suggestions. Yes, I did take a detailed look at your images, but they weren't 100% convincing because it wasn't clear just what was happening. And Adobe's explanation, after reading it again, explains nothing at all to someone who doesn't know how Nearest Neighbor works.
    But you are correct -- Nearest Neighbor does effectively delete pixels. I proved it with the attached 6 x 6 image of coloured pixels (the tiny midget image right after this full stop -- you'll have to go to maximum zoom in PS to see it).
    These are the steps to delete every second row and then every second column.
    1. Select Image > Image Size.
    2. Set Pixel Dimensions > Height to half the original (in this case set to 3 pixels).
    3. Set Resample Image to Nearest Neighbor.
    4. Click OK and the image shoould now consist of three vertical white strips and three vertical Green-Red-Blue stripes.
    5. Repeat steps 1-4, but this time set Pixel Dimensions > Width to half the original (in this case set to 3 pixels). The image should now consist of three horizontal stripes Green-Red-Blue.
    Just to make sure the method worked for every third pixel, I repeated the above steps but with 2 pixels instead of 3 and obtained the correct White-Green, White-Green pattern.
    I resampled the Height and Width separately for the test so that I could see what was happening. In a real example, the height and width can be changed at the same time in the one step, achieving the same results as above.
    Finally, how to explain how Nearest Neighbor works in the simple cases described above?
    Division by 2
    In the case of an exact division by two (pixels numbered from top leftmost pixel), only the even numbered rows and columns remain. To put it a different way, every odd numbered row and column are deleted.
    Division by 3
    Only rows and columns 2, 5, 8, 11... remain.
    Division by N
    Only rows and columns 2, 2+N, 2+2N, 2+3N... remain.
    To put it simply, a resample using Nearest Neighbor (using an exact integer multiple) keeps every Nth row and column, starting from number two. The rest are deleted.

Maybe you are looking for

  • Processed cube sees no changes, but new data have been inserted..

    Simple AdwWorks cube has time dimension with years range from 2000-th to 2007-th. Fact data exists for 2001-2006. 2000-th and 2007-th are empty.  Ok.  I'm insert new data to source fact table for 2001-th  and process the cube. All changes immediately

  • Inbound processing is not happening for XMG integration

    Currently our project deals with B2B and XMG integration We are able to send outbound messages to B2B from XMG successfully. For Inbound messages 1. B2B is picking up payload 2. Identifying Agreement 3. Decrypting and verifies digital signature but c

  • Captivate 8 drag and drop interaction not working

    Hi, I am working with Captivate 8 and created a drag and drop interaction using the drag and drop wizard. For some reason when I preview the interaction some of my drag sources work and others do not. I have searched high and low for what I may be do

  • C309a Fax and scan skips pages

    When I send faxes, or scan, it skips pages - at random... will fax/scan send pages 1,2,3, skip page 4, send page 5,6, skip 7 etc...  no pattern.  Have looked at page size settings - all seems fine. Also - any way to get scanned pages to combine into

  • Delete From More than 1 table without using execute immediate

    Hi, Am new to PL/SQL, I had been asked to delete few of the table for my ETL jobs in Oracle 10G R2. I have to delete(truncate) few tables and the table names are in another table with a flag to delete it or not. So, when ever I run the job it should