How to delete the selected rows in a JTable on pressing a button?
How to delete the selected rows in a JTable on pressing a button?
You are right. I did the same.
Following is the code where some of them might find it useful in future.
jTable1.selectAll();
int[] array = jTable1.getSelectedRows();
for(int i=array.length-1;i>=0;i--)
DefaultTableModel model = (DefaultTableModel)jTable1.getModel();
model.removeRow(i);
}
Similar Messages
-
How to delete the selected rows with a condition in alv
dear all,
i am using the code in object oriented alv.
WHEN 'DEL'.
PERFORM delete_rows.
FORM delete_rows.
DATA : lv_rows LIKE lvc_s_row.
data : wa_ROWs like LVC_S_ROW.
FREE : gt_rows.
CALL METHOD alv_grid->get_selected_rows
IMPORTING
et_index_rows = gt_rows.
IF gt_rows[] IS INITIAL.
MESSAGE s000 WITH text-046.
EXIT.
ENDIF.
loop at gt_rows into wa_ROWs .
if sy-tabix ne 1.
wa_ROWs-INDEX = wa_ROWs-INDEX - ( sy-tabix - 1 ).
endif.
delete gt_sim INDEX wa_ROWs-INDEX .
endloop.
the rows to be deleted from int.tab gt_sim not in the alv display.
all the rows should not be deleted if one of the field in gt_sim eq 'R'.
how to check this conditiondear jayanthi,
ok if i am coding like that as u mentioned ,
it will exit the loop when first time the field value is 'R'.
if any of the selected rows contains field value 'R'. it shold not delete all the selected rows.
as u suggested it will not delete after first time the field value is r.
i am deleting it by tab index so,
suppose if i am selecting the row without field value R say its tabix is 1.
the next row with tabix 2 with field value R.
it deletes the first row and exits , it should not delete the first row also. -
How to identify the Selected row number or Index in the growing Table
Hi,
How to find the selected Row number or Row Index of growing Table using Javascript or Formcalc in Interactive Adobe forms
Thanks & Regards
SrikanthAfter using bellow script it works fine
xfa.resolveNode("Formname.Table1.Row1["this.parent.index"].fieldname").rawValue; -
Getting the Selected Row from a JTable
hi,
how Can i get the Selected row from a JTable
thanks...You know that JTable class? Well, you see those methods in it called "getSelectedRow()" and "getSelectedRows()"...?
-
How to get the selected rows in a table
Hi,
How to get the ids of all the selected rows. On Page load a query is executed that shows the data in a table with a checkbox in the first column to select the rows and delete. Now if a user select multiple rows how do I get the ids of selected rows in the backend code.
ThanksPlease search the forum before posting questions.
refer following thread for table selection.
Re: Record selection with MessageCheckBox and print the selected record.
--Prasanna -
How to get the selected rows & columns in the table?
hi everybody,
In my application the table is kept inside the event structure.I select the cells in the table (using mouse) on running time.How to get the selected number of rows & columns in that table?Hello,
You can fill selected values of the table by writing to it or the corresponding property using a property node - the table is just a 2D array of strings. I think for your "disable" question you are referring to the shortcut menu (when you right click). If you are using LabVIEW 8.x, you can edit or disable that shortcut menu - just right click on your table at edit time and choose Advanced >> Run-Time Shortcut Menu.
Best Regards,
JLS
Best,
JLS
Sixclear -
Check box als column in a standard table, how to get the selected row
Dear experts,
I habe standard tablt with check box as column. Now I want to get the current selected row structure and do some changes. How could I solve this problem? till now I just know to get the structure via lead selection.
lo_node->get_element().
lo_element = lo_node->get_static_attributes ( static_attributes = ls_row).
How could I get the element through check-box in stead of lead selection. Many thanks!check this code
To get the selected row number
data: lr_element type ref to if_wd_context_element,
lv_index type i.
lr_element = wdevent->get_context_element( name = 'CONTEXT_ELEMENT' ).
lv_index = lr_element->get_index( ).
Thanks
Bala Duvvuri -
How to reference the selected row on a report by click a radiobox
I created a report with a column displayed as a radiobox.The report source is like "select htmldb_item.radiogroup(1,.....),rec_id,....from .... where ....",after click one radiobox,i want to get other column's value in the selected row in the after submit process ,can anyone help me?????? how to reference "rec_id" of the selected row?
Hello,
First, please tell us your first name, and update your forum handle. It’s make it easier to track your threads, and help you.
>> apex_application.g_f01(1)" only return the first record's rec_id,if i click radiobox in other rows,it returns the same result as click radiobox in the first row?
The ‘G_F01’ is an array of values, so apex_application.g_f01(1) will always bring you the first element of this array. If you want to retrieve other values from this array, which will include the values of the radiogroup value of the other lines, you need to use a loop. Something like that should work:
for i in 1.. apex_application.g_f01.count loop
… apex_application.g_f01(i) …
end loop;
>> after click one radiobox,i want to get other column's value in the selected row in the after submit process
That means that the value of your radiogroup item should include some indication to the line you are on. If, like in Andy’s example, you can retrieve your record from a table, based on a PK, your radiogroup can return this kind of information. However, if the data on the other columns of the select raw, were just entered/updated by the user (like in a tabular form), the radiogroup item should include information about the row you are in, in order for you to be able to access the corresponding array elements – other G-Fxx arrays – of the other columns in the row. In this case, I believe using checkboxes is preferable.
Regards,
Arie. -
How to read the selected row value of a table node
hi
i have a node of table type, displaying few records & with each record a NEXT button is there.
now i want to read the values of the selected row of the table & want to process next with NEXT button.
pls tell me how to read the values of the selected row only.
reds.data : lo_nd type ref to if_wd_context_node,
lo_nd1 type ref to if_wd_context_node,
lt_temp type wdr_context_element_set,
wa_temp type ref to if_wd_context_element,
ls_node1 type sflight,
lt_node1 type STANDARD TABLE OF sflight.
lo_nd = wd_context->get_child_node('CN_MAIN').
CALL METHOD lo_nd->get_selected_elements
RECEIVING
set = lt_temp.
loop at lt_temp INTO wa_temp.
CALL METHOD wa_temp->get_static_attributes
IMPORTING
static_attributes = ls_node1.
APPEND ls_node1 TO lt_node1.
CLEAR ls_node1.
ENDLOOP.
'CN_MAIN' is the node whose selected values are to be picked and stored in internal table lt_node1.
Other option by Thomas :
DATA lo_nd_cn_main TYPE REF TO if_wd_context_node.
DATA lt_temp TYPE wdr_context_element_set.
FIELD-SYMBOLS <wa_temp> LIKE LINE OF lt_temp.
DATA lt_node1 TYPE wd_this->elements_cn_main.
FIELD-SYMBOLS <ls_node1> LIKE LINE OF lt_node1.
lo_nd_cn_main = wd_context->get_child_node( name = wd_this->wdctx_cn_main ).
lt_temp = lo_nd_cn_main->get_selected_elements( ).
LOOP AT lt_temp ASSIGNING <wa_temp>.
APPEND INITIAL LINE TO lt_node1 ASSIGNING <ls_node1>.
<wa_temp>->get_static_attributes( IMPORTING STATIC_ATTRIBUTES = <ls_node1> ).
ENDLOOP. -
How to save the selected rows from Advance table into database
Hi
I have requirement like..
In custom page , Manager Search the Candidates and selects the candidate ROWS from advance table.
The reqt is how to save the selected multiple rows into the database.hi Reetesh,
In Custom page
Supoose the Recruiter Search is for Position Finance Mangager , it retrieves 100 rows , out of which Recruiter select 10 rows .
So in Such scenario how to save this 10 rows against Recruiter
, i mean , Is i need to create custom table, to save Recruiter , these selected 10 rows.
I hope u understand my question -
[UIX-ADF] How to get the selected row in my ViewObjImpl.java
Hi,
I have a uix table with a select column. I dragged my method from my ViewObjImpl
and dropped it on the select column (radiobutton) as a submitbutton.
If I run my application and select a row and press my button it always reads the first
row. Why?
I also tried including a param in my method, for the record id, but I dont know what to
pass to my action binding as a param, where can I find the selected row?
This is what I want, my method in ViewObjImpl.java
public void doDelete() {
ViewObjRowImpl pRow = (ViewObjRowImpl)this.getCurrentRow();
try {
pRow.setIsDeleted("Y");
//this.executeQuery();
this.getDBTransaction().commitAndSaveChangeSet();
//this.validate();
} catch(Exception e) { System.out.println("ERROR doDelete" + e); }
}It should set the IsDeleted field to 'Y' for the selected row. Perhaps im not doing the
right thing for this?
Can anyone give me some pointers?
Thanks in advance
IdoThanks. So even if you select a row and then press the button, your method still only finds the first row?!
Are you sure that the selection mechanism of your table is working? Your tableSelection fires a select event and your page contains a select handler?
When you wire your page using drag and drop the binding should always use the default iterator of the ViewObject. And getCurrentRow() should always give you the current row of that iterator. So my feeling is that the selection doesn't take place.
Or could it be that something resets the currency in the ViewObject from another place?
Sascha -
How to Highlight the selected row of table
Hi All,
I have a result table. I want the selected row to be highlighted in orange color.
The properties of the table are as follows :
rowSelectable : true
selectionChangeBehaviour : auto
selectionMode : auto
Please let me know what am I missing.
NikhilHi Nikhil,
We too encountered this problem in EP 6.0. The code is correct. Actually
int index=wdContext.nodeSales_Orders1().getLeadSelection();
is enough.
But this is not the problem. It is the problem with either browser or Portal Runtime.
Is your version EP 6.0? Is this a problem for all tables or only this table? Check with other browsers like Mozilla..(or different IE versions).
regards,
Siva -
How to populate the selected row details of table in the next view?
hi,
Im having a table, on selecting a particular row of a table by clicking on a radio button. i need that row details to be passed on(populated) to the next view when i navigate to that view by clicking on a button?
Thanks & Regards,
SureshHi Suresh,
Your scenario is simple. Just follow the ex as shown below
(Assuming you want default selection view provided by table itself.)
1>Create 2 views (Ex:A and B)
2>Create a Context with a node and attributes(For Ex:Person as node and Fname and Last Name as attributes
2>In A view create a table with F name and L Name(map to context as well) and a action button to navigate to B view when you selected a particualr row o.k
3>In B view, create a TextView with mapping to LastName(or all the data if you want from input selection) from the context
If you want you can add back action button from B view to A view for easy navigation.
4>Execute the application and select any row in the table appeared, press next action button,you can see that the selected row details will be shown in second(B) view.
If you do the above example, I think you can easily find the solution for navigation issue.. try it out.
In case if you are not able to ...let me know..I have that example.
Hope that helps
Regards
Praveen -
How to set the Selected row and Column in JTable
Hi,
i have a problem like the JTable having one Method getSelectedRow() and getSelectedColumn to know the Selected row and Column but if i want to explicitly set the Selected Row and Column,then there is no such type of Methods.If anybody has any solution then i will be thankful to him/her.
Praveen K SaxenaIs that what you're looking for? :myTable.getSelectionModel().setSelectionInterval(row, row);
myTable.getColumnModel().getSelectionModel().setSelectionInterval(column, column); -
How to obtain the selected rows in the model with af:Table using selectMany
Hi ,
I am using multi select af:Table and it is based on a programmatically populated view. When the table is single select I can use the getCurrentRow at the view implementation. I wonder whether there is a way to get list of selected rows within the view implementation for the multi-select scenario.
I saw some ways of doing it in the page's backing bean but it will be more appropriate if I could do it at the model project.
Thanks
My environment is JDeveloper 10.1.3.3 and jdk 1.4Thanks for your reply.
What you say makes sense. I thought there might be way of setting the selected rows in the model also as we do woth the current row.
But looks like these two different things.
Anyway I am doing it by passing the values through the backing bean.
Thanks
Maybe you are looking for
-
Looking for suggestions to sync external drives over internet
I have a iMac connected to an external hard drive at my house. I would like to sync this external drive to a another external drive connected to a Mac Mini at my parents house. I would like this sync to happen automatically at night and also be free.
-
Custom field in a custom tabular
Hi, I have created a custom tabular which displays a list of account, and i want to add a custom field on it. I have created the custom field on account field, but when i want to add it on the tabular i don't see the custom field in the column of acc
-
Error message (-50) when trying to buy a movie on itunes store
Trying to buy a movie on itunes store, i'm getting an error msg: "Could not purchase "MOVIE". An unknown error occurred (-50). There has been an error in itunes store. Please try again later." This never occurred in the past. The problem doesn;t seem
-
Vendor creation screen ends in withholding data
My Vendor creation screen ends in withholding data,and the screen having no control.Only way to exit.Now we are unable to create vendor codes,please suggest.
-
Message cannot be transferred to node SMTP due to connection error (final)
HI Gurus, we are gewtting the following error inour test client in SOST transaction. Can someboyd please thriw soem light on how to resolve this? Message cannot be transferred to node SMTP due to connection error (final) Message no. XS816 Diagnosis D