Append new row to the tableview...
Hello All,
I have a tableview with 3 columns.
But out of these 3 only the 2nd column is editable.
Now if I want to append one more row then an empty row is created with the 1rst and 3rd columns as non-editable.
But I want all the fields as editable when i append a new record to the table view.
Is it possible ? if yes can anyone guide me ????????
Regards,
Deepu.K
Hello Raja,
I have gone thru ur code.
But in my case I can't get the rowindex bcoz I donot know the row number.
I'll tell u my scenario.
I have a page which contains :-
1, Input fields,
2, Table view.
3, SAVE Button ( when pressed it should update the internal table of the table view and the respective database tables ).
Now initially when the application is executed all the input fields and the Tableview are filled in the INITIALIZATION accordingly.
Now if the user wants to change he will make the changes and press the SAVE Button.
But,as mentioned above since the tableview is already filled with entries say 2 records are already there with 3 columns.For these 2 records I made the 1rst and the 3rd column as non-editable in the iterator .
Then if the user wants to create one more record he will press the APPEND button and this creates a blank record in the internal table and the same is passed to the table view.
SO, now we have the new row with null values.
Here is the problem ...............*************************************
When appending a new row since in the iterator we mentioned that the 1rst column and the 3rd column as non-editable the newly appended row also has the 1rst and the 3rd columns as non-editable. (which should not happen ).
Now as per ur code u said that
<b>" if p_row_index = <row no. you want to make it editable> "</b>
Now how do i know which row no. should i render ?
I thought in this way :-
if I get the internal table in this iterator method then i will check the value for the 1rst column .
If it is null then i want to make it as editable else non-editable.
But to implement this i don't have the internal table here.
Can I get the internal table with the newly appended row / rows in the iterator method .
If so can u tell me how ?
Plz help me Raja...(:
Regards,
Deepu.K
Similar Messages
-
How to insert a new row in the middle of an set of rows
Hi
How to insert a new row in the middle of an set of rows ? and How to Reset the line id after the new row added ?
Regards,
Sudhir B.Hai,
just try this,
Instead of using omatrix.Addrow(1,-1) use like
omatrix.AddRow( RowCount , Position)
RowCount
The number of rows to add (default is 1)
Position
The position of the new rows (0-based; default is -1, meaning append row to the end)
After adding rows in matrix For, sno.
for i=1 to omatrix.visualrowcount
otext=omatrix.getcellspecific("columnid",i) '--where columnid is the unique id of the sno column
otext.value=i
next i
Hope this helps you.
Thanks & Regards,
Parvatha Solai.N -
CreateInsert puts the new row at the top or second to the last
Dear All,
Just one question, is it possible to configure that when you create a new row in an
editable table, it will be place at the end of the rows of the table?
Use Case:
I have a view object coming from the HR schema's Departments table.
I then dropped this page as an editable table and enabled row selection.
To add new row, I drag the create insert option as a button.
<af:form id="f1">
<af:panelStretchLayout id="psl1">
<f:facet name="bottom">
<af:panelGroupLayout id="pgl1">
<af:commandButton text="Add Row" id="cb1"
actionListener="#{bindings.CreateInsert.execute}"/>
<af:commandButton actionListener="#{bindings.Commit.execute}"
text="Commit" id="cb2"/>
<af:commandButton actionListener="#{bindings.Rollback.execute}"
text="Undo" immediate="true" id="cb3">
<af:resetActionListener/>
</af:commandButton>
</af:panelGroupLayout>
</f:facet>
<f:facet name="center">
<af:table value="#{bindings.DepartmentsView1.collectionModel}"
var="row" rows="#{bindings.DepartmentsView1.rangeSize}"
emptyText="#{bindings.DepartmentsView1.viewable ? 'No data to display.' : 'Access Denied.'}"
fetchSize="#{bindings.DepartmentsView1.rangeSize}"
rowBandingInterval="0"
selectedRowKeys="#{bindings.DepartmentsView1.collectionModel.selectedRow}"
selectionListener="#{bindings.DepartmentsView1.collectionModel.makeCurrent}"
rowSelection="single" id="t1" partialTriggers="::cb1">
<af:column sortProperty="DepartmentId" sortable="false"
headerText="#{bindings.DepartmentsView1.hints.DepartmentId.label}"
id="c4">
<af:inputText value="#{row.bindings.DepartmentId.inputValue}"
label="#{bindings.DepartmentsView1.hints.DepartmentId.label}"
required="#{bindings.DepartmentsView1.hints.DepartmentId.mandatory}"
columns="#{bindings.DepartmentsView1.hints.DepartmentId.displayWidth}"
maximumLength="#{bindings.DepartmentsView1.hints.DepartmentId.precision}"
shortDesc="#{bindings.DepartmentsView1.hints.DepartmentId.tooltip}"
id="it4">
</af:inputText>
</af:column>
<af:column sortProperty="LocationId" sortable="false"
headerText="#{bindings.DepartmentsView1.hints.LocationId.label}"
id="c1">
<af:inputText value="#{row.bindings.LocationId.inputValue}"
label="#{bindings.DepartmentsView1.hints.LocationId.label}"
required="#{bindings.DepartmentsView1.hints.LocationId.mandatory}"
columns="#{bindings.DepartmentsView1.hints.LocationId.displayWidth}"
maximumLength="#{bindings.DepartmentsView1.hints.LocationId.precision}"
shortDesc="#{bindings.DepartmentsView1.hints.LocationId.tooltip}"
id="it2">
</af:inputText>
</af:column>
</af:table>
</f:facet>
<f:facet name="start"/>
<f:facet name="end"/>
<f:facet name="top"/>
</af:panelStretchLayout>But I notice that when I clicked the createinsert button, the new row is appended at the top of the table.
I then tried to click the last row, but when I click the CreateInsert, it is appended before the last row.
How can I configure this so that it will show at the last row?
Thanks.
JDEV 11G PS 3Ramandeep Nanda wrote:
* Insert new Rows at the end of RowSet.
* @param row
@Override
public void insertRow(Row row) {
//go to the end of Rowset if it has rows
Row lastRow = this.last();
if (lastRow != null) {
//insert new row at the end and make it current
int indx = this.getRangeIndexOf(lastRow) + 1;
this.insertRowAtRangeIndex(indx, row);
this.setCurrentRow(row);
} else { // empty Rowset
super.insertRow(row);
} The row will be added at the end. You actually override this method in your voImpl.Works like a charm..
Thanks Ramandeep..learned something new today... -
CUKD_API_DEP_MAINTAIN - Append new rows in existing Dependency
Hello,
I would like to know if ther's any way to append new rows within an existing dependency
without having to reload all pre-existing rows.
I'm already using function CUKD_API_DEP_MAINTAIN but I haven't found the way to
append only new rows.
This problem is due to the fact that my dependencies are reaching more than 9.999 rows
and the dependency index used by the function ( DEPSOURCE-LINE_NO ) is a NUMC 4
Does anyone know if there is a different function I can use or how to work it around
function CUKD_API_DEP_MAINTAIN?Hello Pradeep,
Could you tell me why we are passing parameter FL_SYNCH to blank ? I got similar issue.
Many Thanks,
Jitendra -
How to append new rows in a table with Javascript ?
Hi ,
I'd like to append new rows in a table dynamically using javascript?
Do some of you have already done this before ?Rui's answer will create copies of the entire table. There may be times where thsi is what you want, but you asked about creating new rows. If your new row is a copy of one of your existing rows, then you could use
_RowName.addInstance(1);
(the underscore at the beginning invokes the instance manager). Is this what you're looking for? -
Adding new row to the reports list page
How can I add a new report row in the reports list of the reports tab.
Ex: a new row to the report "users by Date of Join report" is to be added
How can we add Please help me out in thisI am facing the same problem!
camickr wrote:
Try adding an empty row containing a null value for the String instead of the empty String.camickr, it will not help, the DefaultRowSorter in the "*+compare(int model1, int model2)+*" method return -1 if the first value is null and 1 if the sacond value is null. and incase of DESCENDING it mult by -1.
// Treat nulls as < then non-null
if (v1 == null) {
if (v2 == null) {
result = 0;
} else {
result = -1;
} else if (v2 == null) {
result = 1;
} else {
result = sortComparators[counter].compare(v1, v2);
if (sortOrder == SortOrder.DESCENDING) {
result *= -1;
}And this is the real problem!
The empty line is sorted as the smallest value and incase of DESCENDING it will be the first line (because of the mult by -1).
We could have overide it and incase of the empty row(usualy the last row) do not mult by -1 in DESCENDING mode.
But the problem is that the "+*compare*+" method and it's caller "*+Row+*" inner class are private :-(
It is not wise to do it but we can do like kmp83 wrote:
kmp83 wrote:
copy/duplicate "private" code from DefaultRowSorter into my extended class.Anyone have another suggestion? -
Can anyone give me the code for adding the new row in the same page itself.If we click on add button a new row should come in the table.
Thanks in advanceHi,
invoke a method in AM on button click
public void addrows()
AddressesVOImpl vo1 = getAAddressesVO1();
AddressesVORowImpl row1 = (AddressesVORowImpl)vo1.createRow();
vo1.insertRowAtRangeIndex(0,row1);
vo1.setCurrentRow(row1);
Thanks,
Gaurav -
Need to add a new row at the end of the table
Experts,
working jdev 11.1.1.3.0
i am adding row programetically, my requirement need to add the row at after last row.
i tried different ways.
Row newLastRow = getPWBBidLaneVO().last();
int lastRowIndex = getPWBBidLaneVO().getRangeIndexOf(newLastRow);
getPWBBidLaneVO().insertRowAtRangeIndex(lastRowIndex - 1,
laneRow);
this is giving --- java.lang.ArrayIndexOutOfBoundsException: 0
and
http://kohlivikram.blogspot.com/2008/10/add-new-row-in-adf-table-on-button.html --- its giving index out of bound because vo.getRangeSize() is 25. We set this value at vo for performance improment suggestions.
is there a way to add a new row at the end of the table?Add this to the view row impl class
public void insertRow(Row row) {
//go to the end of Rowset if it has rows
Row lastRow = this.last();
if (lastRow !=null){
//insert new row at the end and make it current
int indx = this.getRangeIndexOf(lastRow)+1;
this.insertRowAtRangeIndex(indx,row);
this.setCurrentRow(row);
}else { // empty Rowset
super.insertRow(row);
} -
Add a new row at the top of a table in GUI
Hi,
I am using JDev 11.1.1.1.0. I need to be able to let users add a new row at the top of a table and not anywhere else in the middle of table rows. I cannot seem to find a way to do it. note that it does not matter where a new row gets inserted in the db, i am only concerned about restricting the insert in the GUI to the topmost line/row.
Thanks,
AJHi
Can you try with writing your custom create method in application module and calling same from UI on command button action like
public void createNewRow()
ViewObjectImpl vo = getVO1();
Row newRow= vo.createRow()
vo.insertRowAtRangeIndex(0, newRow);
Vikram -
BAPI to insert a new row in the MCHA table
Hi all,
I am in search of a BAPI to insert a new row in the MCHA table... with the fields of the materail, plant and batch values.
Any inputs on this..is highly appreciable...
thanks in advance...
regards..
prathima.explore BAPI_BATCH_CREATE
-
BAPI to insert a new row in the AUSP table
Hi all,
I am in search of a BAPI to insert a new row in the AUSP table... with the fields of the object and
characteristic values.
Any inputs on this..is highly appreciable...
thanks in advance...
regards..
prathima.hi,
from best of my knowledge here is list of bapi through you can insert ausp table.
check it.
CLSE_SELECT_AUSP
CLVF_INSERT_AUSP
BAPI_CLASS_CREATE
C14K_AUSP_CHANGE_VALUE
CLSE_SELECT_AUSP
CLVF_UPDATE_AUSP
C14K_AUSP_ADD_UPD
BAPI_CLASS_CREATE
regards,
vipul -
To add new row with the checkbox selected ....
Hi All,
In my project I have to create a table with 2 columns, 1 column is checkbox and other column is String type. In the same JFrame one textarea and one add button should be there. When we type text in the textarea and click add button, it should add a new row in the table with the checkbox selected and the 2nd column containing the text.
I want to use AbstractTableModel.
Please help me to solve this issue. If you have sample code that will be more helpful.
Thank you,
Regards,
mkumarIt would be better if you extend from DefaultTableModel rather than from Abstract Table Model. That is because DefaultTableModel provides functionality to add a row. In fact, you can directly use DefaultTableModel .
In the button's action performed,
public void actionPerformed(ActionEvent e)
if(e.getSource() == bAdd)
Vector newRow = new Vector(2);
newRow.add(new Boolean(Boolean.TRUE));
newRow.add(" ");
DefaultTableModel dm = (DefaultTableModel)yourTable.getModel();
dm.addRow(newRow);
}Note : For the above code, Initialize the JTable with a DefaultTableModel parameter than directly with Vectors/ Arrays.
This is because when we try to cast from TableModel to DefaultTableModel as in the above code, there is a possibility of an
Exception if the Table is not initialized without a model.
For the CheckBox in the first column, you need to set an editor and a renderer so that you can manipulate and see your boolean values as the state of the check boxes.
JCheckBox b = new JCheckBox();
DefaultTableCellRenderer dr = new DefaultTableCellRenderer(b);
DefaultTableCellEditor de = new DefaultTableCellEditor(b);
yourTable.getColumnModel().getColumn(0).setCellEditor(de);
yourTable.getColumnModel().getColumn(0).setCellRenderer(dr);That should do it !
Cheers -
Add new Row at the bottom of the advance table
Hi,
I have an advance table which is displaying 50 rows per page. I have a button at the bottom of the table to add a new row in the table.
Requirement is whenever user clicks on the button to add a new row and if he is viewing the 50-100 rows, new row should be added at the bottom of the same page giving 101st row as new row.
Is this functionality possible. Please let me know the code for the same.
Thanks in advance,
KaushikHi,
If the records displayed is set to 50 then at one time only 50 records will be visible.
101st row will be inserted at seperate navigation 100-150.
Instead you can insert the row at the top so that 100th row gets shifted to 101 and new row becomes on the same page
for this use
vo.insertRowatRangeIndex(row,0);
Thanks,
Gaurav -
How to append new row in rowset with parameter?
Hi,
In the data input page in prerender method I have this code to filter rowset with non existing id in the table to show empty table on the page:
try {
getSessionBean1().getKoordinatesRowSet().setObject(1, non_existing_id);
} catch (Exception e) {
error("klaida koord " + e);
}After this I have empty table and I want with a button on the page append one or more rows, fill them and save to my db. I try with this code:
public String addBtn_action() {
try {
RowKey rk = koordinatesDataProvider.appendRow();
koordinatesDataProvider.setCursorRow(rk);
} catch (Exception ex) {
log("Negaliu prideti eilutes ", ex);
error(ex.getMessage());
return null;
}But new row does not appear. When I remove parameter in RowSet and remove code from prerender method all works fine, but I see all data from the table that was entered before. Like I said - I want to have an empty table and be able to append one or more new rows, fills them and save to my db. How can I resolve this?Rui's answer will create copies of the entire table. There may be times where thsi is what you want, but you asked about creating new rows. If your new row is a copy of one of your existing rows, then you could use
_RowName.addInstance(1);
(the underscore at the beginning invokes the instance manager). Is this what you're looking for? -
Editable ALV Grid: Append new rows
Hi All,
I have developed a report which will displays output in editable ALV grid list. Users can modify the values in output and save. These values will be stored in one custom table.
My requirement is whenever user clicks on '+' mark (Create entries or Append or Copy: Standard toolbar) report should allow to enter new entries and save. How do I capture the selected function code? why becuase i need to display one value from the custom table in that added new row...
Regards,
Ramesh.Hi Ramesh,
please check changed data event.....
please go through the reference link......
https://wiki.sdn.sap.com/wiki/display/Snippets/UpdatingtheInternalTable-AfterEditinALVusingFunctionModules
Regards,
Venkat
Maybe you are looking for
-
i formatted my computer and now i would like to sync my music from my iphone back to the computer, is there any way to do this? i don't want to loose my music. p.s. all my music that was on the computer was there privately, i did not get it from itun
-
HT1473 How to add music from macbook pro to iPad
How do I add musci from Macbok pro to ipad2?
-
Do i need to reinstall programs and applications like FCP after upgrading to the new Lion OS?
Do i need to reinstall programs and applications like FCP after upgrading to the new Lion OS?
-
What is the best way to build a news system?
Hi everyone, I am building a website using webcenter and I need to do a section called "News". The Editor user is going to put on this section some news about the company. The doubt is: What is the best way to do is? There is a way to integrate the w
-
JDeveloper 10.1.2.1 - Multi form JClient Application
Hi, I am struggling to complete my first Swing application using Jdeveloper 10.1.2.1. I use the wizard to generate 3 forms: 1) an empty ADF form ( MainForm.java ) its working fine ! 2) an ADF form ( FirstForm.java ) based on a view. It working fine !