Skip to Content
author's profile photo Former Member
Former Member

How To Delete a Row From a TableView !!!!

Hi,

Does any know how to delete a row from a table view model.

I have a TableViewModel being displayed, when the user select the particular row and click delete i want that particular row to be deleted.

Any Suggestions How.

Thanks,

Emmanuel.

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jan 06, 2005 at 03:46 PM

    I think you have to find out which row has been clicked, fetch the existing tableviewmodel and remove the row there, and then create a new tableview

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 07, 2005 at 07:54 PM

    If u want to delete single row, then set the property of TableView - selectionMode="SINGLESELECT". Select the radio button and click on delete button. In the main program, you can get the row value like...

    public void onDeleteButtonClicked(Event event) throws PageException {

    TableView table = (TableView) this.getComponentByName ("idTableView");

    DefaultTableViewModel dmodel = myBean.beanModel;

    String pid = "", row_selected;

    // Get the first visible row

    int firstVisibleRow = table.getVisibleFirstRow();

    // Get the last visible row

    int lastVisibleRow = table.getVisibleLastRow();

    for (int i = firstVisibleRow; i <= lastVisibleRow; i++) {

    if (table.isRowSelected(i)) {

    row_selected = i;

    pid = dmodel.getValueAt(i, 1).toString();

    }

    }

    }

    "i" will give you the row no, pid has the value of the row at first column.

    Hope this helps.

    Thanks,

    Praveen

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.