How to delete a selected row from datagrid and how to create a datagrid popup
hi friends,
I am new to flex.i am doing a flex4 application,i need help for this.
i am having a data grid with columns.i have two questions.
Ques 1: when i selected a partiuclar row from a datagrid and click delete button means that record will delete from the datagrid and DTO from the cloud tables also.
Ques 2: when i save the data grid values using save button means that data will store in respective cloud DTO which is related to the datagrid,
My requirement is i am using a search button when i click the search button it will show a datagrid that datagrid will contain the previous datagrid datas which is saved in the cloud.
REQUIREMENT example: first screen: i am using with data grid 3 columns (Student Roll number ,Student Name,Student pecentage)---->save--->data will store in cloud DTO.
Second screen: search button ----> it need show datagrid popup.it will have data which we saved in the first screen with same columns(Student Roll number ,Student Name,Student pecentage).
This is my requirement.
Any suggession welcome.
Thanks in advance.
B.Venkatesan
Lets break the problem statement in multiple steps
1. We need a way to know the selection on all rows.
2. We need the association of the checkBox with the data
The solution is to use a arrayCollection/array that holds all the instances created for checkbox.This collection should be a property of component containing the datagrid. We need to use a custom component implementation or inline ItemRenderer. The way you have used is called dropinItemRenderer. Preferaly use custom component implementation and add the instance to the arrayCollection at CreationComplete. Make sure you use addItemAt so that you add the instance in the same row as the data. To get rowIndex the custom Checkbox should implement IDropInListItemRenderer. You could iterate this collection to check all the instances that are checked.
Note: This is the approach considering your dataprovider doesnt have a selection field.
Nishant
Similar Messages
-
How to delete a Selected row from datagrid and how to create a datagrid popup with saved values
hi friends,
I am new to flex.i am doing a flex4 application,i need help for this.
i am having a data grid with columns.i have two questions.
Ques 1: when i selected a partiuclar row from a datagrid and click delete button means that record will delete from the datagrid and DTO from the cloud tables also.
Ques 2: when i save the data grid values using save button means that data will store in respective cloud DTO which is related to the datagrid,
My requirement is i am using a search button when i click the search button it will show a datagrid that datagrid will contain the previous datagrid datas which is saved in the cloud.
REQUIREMENT example: first screen: i am using with data grid 3 columns (Student Roll number ,Student Name,Student pecentage)---->save--->data will store in cloud DTO.
Second screen: search button ----> it need show datagrid popup.it will have data which we saved in the first screen with same columns(Student Roll number ,Student Name,Student pecentage).
This is my requirement.
Any suggession welcome.
Thanks in advance.
B.VenkatesanLets break the problem statement in multiple steps
1. We need a way to know the selection on all rows.
2. We need the association of the checkBox with the data
The solution is to use a arrayCollection/array that holds all the instances created for checkbox.This collection should be a property of component containing the datagrid. We need to use a custom component implementation or inline ItemRenderer. The way you have used is called dropinItemRenderer. Preferaly use custom component implementation and add the instance to the arrayCollection at CreationComplete. Make sure you use addItemAt so that you add the instance in the same row as the data. To get rowIndex the custom Checkbox should implement IDropInListItemRenderer. You could iterate this collection to check all the instances that are checked.
Note: This is the approach considering your dataprovider doesnt have a selection field.
Nishant -
How to delete a selected row from adf table
Hi
I am using a ADF Table to get data from the database, i need to select a specific row and then delete it how to get
this done.
Thanks in Advance.Or try this code:
In your backing bean:
public void deleteRows(ActionEvent actionEvent) {
((AppModuleImpl)getApplicationModuleForDataControl()).deleteRowEmp();
public static Object resolveExpression(String expression)
try
FacesContext facesContext = FacesContext.getCurrentInstance();
Application app = facesContext.getApplication();
ExpressionFactory elFactory = app.getExpressionFactory();
ELContext elContext = facesContext.getELContext();
ValueExpression valueExp =
elFactory.createValueExpression(elContext, expression, Object.class);
return valueExp.getValue(elContext);
catch (Exception e)
;// log you message here
return null;
* Get application module for an application module data control by name.
* @param name application module data control name
* @return ApplicationModule
public static ApplicationModule getApplicationModuleForDataControl()
return (ApplicationModule) resolveExpression("#{data.AppModuleDataControl.dataProvider}");
}In your AppmoduleImpl:
public void deleteRowEmp(){
this.getEmpView1().removeCurrentRow();
this.getDBTransaction().commit();
}And another option is to expose the appmodule method as a client and bind to the jspx as a button. -
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);
} -
How to delete an email simultaneously from iPad and iMac?
How to delete an email simultaniously from iPad and iMac?
If you have iCloud activated on both that's what will happen.
-
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 delete the committed row from a table from its VOImpl class ??
I am new to ADF and I have problem to solve. To perform roll back I am using fetching key before roll back and setting it after undo operation, so that I can stay back in the currently selected row. But in my case I am using application model commit for one LOV attribute selection in the row. So when ever I am performing roll back operation after inserting a row, the values other than this committed LOV attribute gets roll backed, but I need remove the entire row from table. Does there any option to remove a row based on the attribute values of a row from VO's row implementation or from bean class in a performance optimized way ?
Thanks in advance..........http://java.sun.com/javase/6/docs/api/javax/swing/table/DefaultTableModel.html#removeRow(int)
Why did you mark it answered but gave no dukes to finalight? That's not how it works.
You should mark his answer as correct and give him at least one duke, for the effort! -
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 -
How to move the selected rows from a table control in dialog programming
hiiiiiiii Every1
I have to update some fields for a slected row in table control on click of a button and save it in database.
Regards
Sachin Dhingrasee below example, I have added INSERT option after DELETE option, you can use same table or you can use differnt table by populating into that table and insert into the db table. If you want to use same internal table then use below code
LOOP AT itab INTO demo_conn WHERE mark = 'X'.
insert into table from itab.
ENDLOOP.
REPORT demo_dynpro_tabcont_loop_at.
CONTROLS flights TYPE TABLEVIEW USING SCREEN 100.
DATA cols LIKE LINE OF flights-cols.
DATA: ok_code TYPE sy-ucomm,
save_ok TYPE sy-ucomm.
DATA: itab TYPE TABLE OF demo_conn.
TABLES demo_conn.
SELECT * FROM spfli INTO TABLE itab.
LOOP AT flights-cols INTO cols WHERE index GT 2.
cols-screen-input = '0'.
MODIFY flights-cols FROM cols INDEX sy-tabix.
ENDLOOP.
CALL SCREEN 100.
MODULE status_0100 OUTPUT.
SET PF-STATUS 'SCREEN_100'.
ENDMODULE.
MODULE cancel INPUT.
LEAVE PROGRAM.
ENDMODULE.
MODULE read_table_control INPUT.
MODIFY itab FROM demo_conn INDEX flights-current_line.
ENDMODULE.
MODULE user_command_0100 INPUT.
save_ok = ok_code.
CLEAR ok_code.
CASE save_ok.
WHEN 'TOGGLE'.
LOOP AT flights-cols INTO cols WHERE index GT 2.
IF cols-screen-input = '0'.
cols-screen-input = '1'.
ELSEIF cols-screen-input = '1'.
cols-screen-input = '0'.
ENDIF.
MODIFY flights-cols FROM cols INDEX sy-tabix.
ENDLOOP.
WHEN 'SORT_UP'.
READ TABLE flights-cols INTO cols WITH KEY selected = 'X'.
IF sy-subrc = 0.
SORT itab STABLE BY (cols-screen-name+10) ASCENDING.
cols-selected = ' '.
MODIFY flights-cols FROM cols INDEX sy-tabix.
ENDIF.
WHEN 'SORT_DOWN'.
READ TABLE flights-cols INTO cols WITH KEY selected = 'X'.
IF sy-subrc = 0.
SORT itab STABLE BY (cols-screen-name+10) DESCENDING.
cols-selected = ' '.
MODIFY flights-cols FROM cols INDEX sy-tabix.
ENDIF.
WHEN 'DELETE'.
READ TABLE flights-cols INTO cols WITH KEY screen-input = '1'.
IF sy-subrc = 0.
LOOP AT itab INTO demo_conn WHERE mark = 'X'.
DELETE itab.
ENDLOOP.
ENDIF.
WHEN 'INSERT'.
READ TABLE flights-cols INTO cols WITH KEY screen-input = '1'.
IF sy-subrc = 0.
LOOP AT itab INTO demo_conn WHERE mark = 'X'.
itab1 = itab.
modify itab1.
ENDLOOP.
ENDIF.
if not itab1 is initial.
INSERT dbtab FROM TABLE itab1.
endif.
ENDCASE.
ENDMODULE. -
How to delete the duplicate rows from the table
Hi,
I have 2 tbales namely component, component_audit
For each record in component table there are multiple entries in component_audit table.
I need to keep the first record and delete the others from the component_audit table
say for example
select a.component_id,a.dt_ti_stamp,a.component_name,a.column_before,b.comments from component_audit a,component b where a.component_id=b.component_id
( on the above result set only I shold apply the actual delete query )
PLease help me in this regards.
Thanks.delete from component_audit a where dt_ti_stamp not in (select
min(b.dt_ti_stamp)
from
component_audit b
where
a.component_id = b.component_id) -
Delete operation is not working to delete selected row from ADF table
Hi All,
We are working on jdev 11.1.1.5.3. We have one ADF table as shown below. My requirement is to delete a selected row from table, but it is deleting the first row only.
<af:table value="#{bindings.EventCalendarVO.collectionModel}" var="row"
rows="#{bindings.EventCalendarVO.rangeSize}"
emptyText="#{bindings.EventCalendarVO.viewable ? applcoreBundle.TABLE_EMPTY_TEXT_NO_ROWS_YET : applcoreBundle.TABLE_EMPTY_TEXT_ACCESS_DENIED}"
fetchSize="#{bindings.EventCalendarVO.rangeSize}"
rowBandingInterval="0"
selectedRowKeys="#{bindings.EventCalendarVO.collectionModel.selectedRow}"
selectionListener="#{bindings.EventCalendarVO.collectionModel.makeCurrent}"
rowSelection="single" id="t2" partialTriggers="::ctb1 ::ctb3"
>
To perform delete operation i have one delete button.
<af:commandToolbarButton
text="Delete"
disabled="#{!bindings.Delete.enabled}"
id="ctb3" accessKey="d"
actionListener="#{AddNewEventBean. *deleteCurrentRow* }"/>
As normal delete operation is not working i am using programatic approach from bean method. This approach works with jdev 11.1.1.5.0 but fails on ver 11.1.1.5.3
public void deleteCurrentRow (ActionEvent actionEvent) *{* DCBindingContainer bindings =
(DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
DCIteratorBinding dcItteratorBindings =
bindings.findIteratorBinding("EventCalendarVOIterator");
// Get an object representing the table and what may be selected within it
ViewObject eventCalVO = dcItteratorBindings.getViewObject();
// Remove selected row
eventCalVO.removeCurrentRow();
it is removing first row from table still. Main problem is not giving the selected row as current row. Any one point out where is the mistake?
We have tried the below code as well in deleteCurrentRow() method
RowKeySet rowKeySet = (RowKeySet)this.getT1().getSelectedRowKeys();
CollectionModel cm = (CollectionModel)this.getT1().ggetValue();
for (Object facesTreeRowKey : rowKeySet) {
cm.setRowKey(facesTreeRowKey);
JUCtrlHierNodeBinding rowData = (JUCtrlHierNodeBinding)cm.getRowData();
rowData.getRow().remove();
The same behavior still.
Thanks in advance.
Rechin
Edited by: 900997 on Mar 7, 2012 3:56 AM
Edited by: 900997 on Mar 7, 2012 4:01 AM
Edited by: 900997 on Mar 7, 2012 4:03 AMJDev 11.1.1.5.3 sounds like you are using oracle apps as this not a normal jdev version.
as it works in 11.1.1.5.0 you probably hit a bug which you should file with support.oracle.com...
Somehow you get the first row instead of the current row (i guess). You should debug your code and make sure you get the current selected row in your bean code and not the first row.
This might be a problem with the bean scope too. Do you have the button (or table) inside a region? Wich scope does the bean have?
Anyway you can try to remove the iterator row you get
public void deleteCurrentRow (ActionEvent actionEvent) { DCBindingContainer bindings =
(DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
DCIteratorBinding dcItteratorBindings =
bindings.findIteratorBinding("EventCalendarVOIterator");
dcItteratorBindings.removeCurrentRow();Timo -
Need sample code to get handle of Selected rows from ADF Table
Hi,
I am new to ADF. I have an ADF table based on VO object.On some button action,I need to get handle of selected rows in application module.
If anybody is having sample code to do this then please share with me.
Thanks,
ashokwow now link http://blogs.oracle.com/smuenchadf/examples/#134 is working.thanks a lot.
also the link http://baigsorcl.blogspot.com/2010/06/deleting-multi-selected-rows-from-adf.html is very useful. Thanks a lot for Sameh Nassar too.He made it clear that in 11g Select column is not available for a ADF table and provided a solution to get Select column.
Thanks,
ashok -
How to store data from textfile to vector and delete a selected row.
Can someone teach me how to store data from textfile to vector and delete a selected row. And after deleting, i want to write the changes in my textfile.
Do someone has an idea? :)nemesisjava wrote:
Can someone teach me how to store data from textfile to vector and delete a selected row. And after deleting, i want to write the changes in my textfile.
Do someone has an idea? :)What's the problem? What have you done so far? What failed?
What you described should be pretty easy to do. -
How to move a selected row data from one grid to another grid using button click handler in flex4
hi friends,
i am doing flex4 mxml web application,
i am struck in this concept please help some one.
i am using two seperated forms and each form having one data grid.
In first datagrid i am having 5 rows and one button(outside the data grid with lable MOVE). when i am click a row from the datagrid and click the MOVE button means that row should disable from the present datagrid and that row will go and visible in the second datagrid.
i dont want drag and drop method, i want this process only using button click handler.
how to do this?
any suggession or snippet code are welcome.
Thanks,
B.venkatesan.Hi,
You can get an idea from foolowing code and also from the link which i am providing.
Code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
width="613" height="502" viewSourceURL="../files/DataGridExampleCinco.mxml">
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.binding.utils.BindingUtils;
[Bindable]
private var allGames:ArrayCollection;
[Bindable]
private var selectedGames:ArrayCollection;
private function initDGAllGames():void
allGames = new ArrayCollection();
allGames.addItem({name: "World of Warcraft",
creator: "Blizzard", publisher: "Blizzard"});
allGames.addItem({name: "Halo",
creator: "Bungie", publisher: "Microsoft"});
allGames.addItem({name: "Gears of War",
creator: "Epic", publisher: "Microsoft"});
allGames.addItem({name: "City of Heroes",
creator: "Cryptic Studios", publisher: "NCSoft"});
allGames.addItem({name: "Doom",
creator: "id Software", publisher: "id Software"});
protected function button1_clickHandler(event:MouseEvent):void
BindingUtils.bindProperty(dgSelectedGames,"dataProvider" ,dgAllGames ,"selectedItems");
]]>
</mx:Script>
<mx:Label x="11" y="67" text="All our data"/>
<mx:Label x="10" y="353" text="Selected Data"/>
<mx:Form x="144" y="10" height="277">
<mx:DataGrid id="dgAllGames" width="417" height="173"
creationComplete="{initDGAllGames()}" dataProvider="{allGames}" editable="false">
<mx:columns>
<mx:DataGridColumn headerText="Game Name" dataField="name" width="115"/>
<mx:DataGridColumn headerText="Creator" dataField="creator"/>
<mx:DataGridColumn headerText="Publisher" dataField="publisher"/>
</mx:columns>
</mx:DataGrid>
<mx:FormItem label="Label">
<mx:Button label="Move" click="button1_clickHandler(event)"/>
</mx:FormItem>
</mx:Form>
<mx:Form x="120" y="333">
<mx:DataGrid id="dgSelectedGames" width="417" height="110" >
<mx:columns>
<mx:DataGridColumn headerText="Game Name" dataField="name" width="115"/>
<mx:DataGridColumn headerText="Creator" dataField="creator"/>
<mx:DataGridColumn headerText="Publisher" dataField="publisher"/>
</mx:columns>
</mx:DataGrid>
</mx:Form>
</mx:Application>
Link:
http://social.msdn.microsoft.com/Forums/en-US/winformsdatacontrols/thread/ae9bee8d-e2ac-43 c5-9b6d-c799d4abb2a3/
Thanks and Regards,
Vibhuti Gosavi | [email protected] | www.infocepts.com -
How to delete(remove) one row(record) from a dynamic table
Hi,
I have adynamically created table.
I want to delete 1 record(Row) from that Dynamic table.
Say if my dynamic table contains 5 records(rows);after deletion of 1 record(1 complete row)from that dynamic table,the number of records(rows) should be 4 .
Please suggest me how to proceed.
Please provide me some sample code.Its not working
I tried with these code:-Its not working-->
IPrivateExportexView.IEt_WriteoffNode node=wdContext.nodeEt_Writeoff();
IPrivateExportexView.IEt_WriteoffElement nodeEle= node.createEt_WriteoffElement(new Zfrm_Writeoff_P());
node.removeElement(nodeEle);
Please suggest
Thanks
-SandipHi,
*int n=wdContext.nodeTable().getLeadSelection();*
*wdContext.nodeTable().removeElement(wdContext.nodeTable().getTableElementAt(n));*
Further more , an example is given below for better understanding , do modifications according to your need.
node :
value node - Table (cardinality - 0..n , selection 0..1)
no ( value attribute - string )
name (value attribute - string )
// create node elements
for(int i=0;i<5;i++)
IPrivateClearnodeElements.ITableNode node = wdContext.nodeTable();
IPrivateClearnodeElements.ITableElement ele = node.createTableElement();
ele.setNo((101i)"");
ele.setName("name :"(i1));
node.addElement(ele);
// Apply template Table -- select -- table node or
// create a table UI element and set the property Datasource - Table ( of the context)
Insert Colum , in that column, next insert celleditor , of type text view , bind the property text -- to "name " of Table node of the context
Insert Colum , in that column, next insert celleditor , of type text view , bind the property text -- to "no " of Table node of the context
// create a action "removeElement"
// create a button "Remove Element " --> Event action -- removeElement
// under the action write down the code :
public void onActionremoveElement(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
//@@begin onActionremoveElement(ServerEvent)
// before removing display elements
wdComponentAPI.getMessageManager().reportSuccess("Before deletion :");
for(int i=0;i<wdContext.nodeTable().size();i++)
wdComponentAPI.getMessageManager().reportSuccess(wdContext.nodeTable().getTableElementAt(i).getNo()) ;
wdComponentAPI.getMessageManager().reportSuccess(wdContext.nodeTable().getTableElementAt(i).getName()) ;
int n=wdContext.nodeTable().getLeadSelection();
wdContext.nodeTable().removeElement(wdContext.nodeTable().getTableElementAt(n));
// After deletion
wdComponentAPI.getMessageManager().reportSuccess("After deletion :");
for(int i=0;i<wdContext.nodeTable().size();i++)
wdComponentAPI.getMessageManager().reportSuccess(wdContext.nodeTable().getTableElementAt(i).getNo()) ;
wdComponentAPI.getMessageManager().reportSuccess(wdContext.nodeTable().getTableElementAt(i).getName()) ;
//@@end
If helpful , give points .
Let me know if any problem u face .
Thanks,
Srini
Maybe you are looking for
-
OS 9 not booting after Norton disk fix
Background -> I am a Mac nub. I am considering switching from pc to Mac at home because I hate windows stability. Question -> I was given a G3 Beige with OS 9.0. Norton utilities software was installed and while running the disk checker (I don't reme
-
ITunes 10 Crash when selecting Apps Tab in Sync
My Itunes crashes every time i try to view the apps on my Iphone in the Sync screen. I do not have a jail-broken phone and i am running Iphone 4.02 on both a 16 and 32gb Iphone 3Gs. Anyone else having this problem or know a fix???
-
Reg: PDF to SWF Conversion
Hi mate How do convert to pdf to swf using flex application. Thanks
-
Using an external monitor with FCP Studio v. 1.0
I cannot get my external monitor to display my timeline editing window. I have made the right connections, with firewire from Mac to Sony HDV tapedeck, and with HDMI cable from tapedeck to LCD monitor, but the screen remains blank. The external video
-
Another DNS Zone Question! :)
I have several geographic sites all with their own leopard servers (ten or so). Each are open directory masters managing public ip subnets. We do have an external dns server and all of our servers have registered names that are part of the same domai