Tableview,PREVSELECTEDROWINDEXTABLE.
Hi Guru's,
I am doing a small coding with tableview,multiple selection .
iam getting the data in the tableview and multiple selection is also wrking.
but my problem is when i select multiple options in the table view and click on the button which is below the table view i want to update that selected rows to one ztable.
so when i debug the code iam getting the multiple selected rows in
TV ?= CL_HTMLB_MANAGER=>GET_DATA(
REQUEST = RUNTIME->SERVER->REQUEST
NAME = 'tableview'
ID = 'tv_output' ).
TV_DATA = TV->DATA. .
READ TABLE LT_OUTPUT INTO WA_SELECTEDQUES INDEX TV_DATA->PREVSELECTEDROWINDEXTABLE.
ENDIF.
ENDIF.
here in this iam getting those rows TV_DATA->PREVSELECTEDROWINDEXTABLE.
but when i run the above code
it throws an error i,e
PREVSELECTEDROWINDEXTABLE. may not be convereted to number.
so pls help me out
Hi Bhavana,
The "read table" abap statement with index extension allows only a number / number type variable.
your variable "TV_DATA->PREVSELECTEDROWINDEXTABLE" is not of number time.
The "TV_DATA->PREVSELECTEDROWINDEXTABLE" type is a table type "INT4_TABLE".
So in order to read the row contents you need to loop at this table and put your read statement inside the loop.
For eg.
data: indx type int4.
loop at TV_DATA->PREVSELECTEDROWINDEXTABLE into indx.
READ TABLE LT_OUTPUT INTO WA_SELECTEDQUES INDEX indx.
"Use the WA_SELECTEDQUES to insert it into a db table.
endloop.
Hope it helps!
Regards,
Maheswaran
Similar Messages
-
Hello,
Using a tableview with table iterator, the user can select one or more lines and delete them by using a button.
A server event is triggered then to delete the data on the database. But afterwards the tableview appears with the same row indexes selected. But I don't
want to have any selected rows afterwards and I don't know
in fact where this indexes are from, where they are kept.
The selected rows come from table->data
->PREVSELECTEDROWINDEXTABLE to delete the selected rows.
The deletion of this indextable afterwards does not help to get rid of the selected rows after the server event.
<htmlb:tableView id = "<%= l_ref_wa-QSDS_I_R3QSC_FIELDS-fields %>"
table = "//g_page1model_view/QSDS_I_QS_INPUT_NR2"
headerVisible = "FALSE"
footerVisible = "FALSE"
design = "alternating"
selectionMode = "MULTISELECT"
iterator = "<%= g_page1model_view->tv_iterator %>"
focus1stSelectedCell = "FALSE"
tabIndexCell = "FALSE"
tableLayout = "FIXED"
keepSelectedRow = "FALSE"
headerText = "<%= l_ref_wa-header %>"
allRowsEditable = "X" />
Anyone could help me.
kind regards.
CarolaHi Carola,
some months ago a cool dude in this forum posted this code =)
cl_htmlb_manager=>check_tableview_all_rows(
rowcount = table_event->ROWCOUNT
request = request
id = '<YOUR TABLEID>'
keytable = table_event->PREVSELECTEDROWKEYTABLE
check = '' ).
I am using it to deselect my tables and it works without any problems, have fun.
regards
Thomas -
TableView - alterable column entries (edit)
Hello,
I have the following TableView:
< code>
<htmlb:tableView id ="decisiontab"
visibleRowCount = "15"
headerText = "Decision View"
headerVisible = "true"
design = "alternating"
fillUpEmptyRows = "true"
onHeaderClick = "MyEventHeaderClick"
onRowSelection = "MyEventRowSelection"
keyColumn = "zmoppid"
table = "<%= zomopporttab %>"
iterator = "<%= iterator %>"
selectionMode = "MULTILINEEDIT" >
</htmlb:tableView>
<%-- Drucktasten --%>
<htmlb:button id = "save"
text = "<b>Save</b>"
encode = "FALSE"
onClick = "myButtonSave" />
< /code>
The iterator produce a TableView underit the following two columns:
GET_COLUMN_DEFINITION:
< code>
append initial line to p_column_definitions assigning <def>.
<def>-columnname = 'ZMDECIFLAG'.
<def>-title = 'Decision'.
<def>-edit = 'X'.
<def>-HORIZONTALALIGNMENT = 'center'.
append initial line to p_column_definitions assigning <def>.
<def>-columnname = 'DECI_IMAGE'.
<def>-title = 'Image'.
< /code>
RENDER_CELL_START:
< code>
case P_COLUMN_KEY.
when 'ZMDECIFLAG'.
if M_ROW_REF->ZMDECIFLAG is initial.
P_REPLACEMENT_BEE = CL_HTMLB_CHECKBOX=>FACTORY( ID = P_CELL_ID
CHECKED = 'FALSE' ).
else.
P_REPLACEMENT_BEE = CL_HTMLB_CHECKBOX=>FACTORY(
ID = P_CELL_ID CHECKED = 'TRUE' ).
endif.
when 'DECI_IMAGE'.
data: ICON type STRING.
if M_ROW_REF->ZMDECIFLAG is initial.
ICON = CL_BSP_MIMES=>SAP_ICON( ID = 'ICON_LED_RED' ).
else.
ICON = CL_BSP_MIMES=>SAP_ICON( ID = 'ICON_LED_GREEN' ).
endif.
P_REPLACEMENT_BEE = CL_HTMLB_IMAGE=>FACTORY( ID = P_CELL_ID
SRC = ICON ).
endcase.
< /code>
I would like to reach the following:
The user changes the condition of the check box (marked/ not marked) in several lines and presses then the save button. Without selecting the lines before!
1.
Is a Tableview with multieditselect correct?
And how can I query the Event?
2. (beautiful would be also)
How can I reach it that when changing the condition of the checkbox (marked/unmarked) also the Icon changes.
Does anybody know about this problem.
Thanks for any advice or path for more information.
Kind Regards
PetraSo Petra I guess a SP upgrade is in order.
You could also try this code but I think you'll have the same problem due to the SP level.
<i><b>OnInputProcessing</b></i>
CLASS CL_HTMLB_MANAGER DEFINITION LOAD.
DATA: tv type ref to CL_HTMLB_TABLEVIEW,
event type ref to CL_HTMLB_EVENT,
table_event type ref to CL_HTMLB_EVENT_TABLEVIEW.
field-symbols <i> like line of selectedRowIndexTable.
tv ?= CL_HTMLB_MANAGER=>GET_DATA( request = request
name = 'tableView'
id = 'tvX' ).
IF tv IS NOT INITIAL.
table_event = tv->data.
clear selectedRowIndexTable.
selectedRowIndexTable = table_event->PREVSELECTEDROWINDEXTABLE.
if table_event->event_type eq CL_HTMLB_EVENT_TABLEVIEW=>CO_ROW_SELECTION.
read table selectedRowIndexTable with key table_line = table_event->ROW_INDEX
transporting no fields.
if sy-subrc eq 0.
delete selectedRowIndexTable index sy-tabix.
else.
append initial line to selectedRowIndexTable assigning <i>.
<i> = table_event->ROW_INDEX.
endif.
endif.
ENDIF.
<i><b>OnCreate</b></i>
select * from sflight into corresponding fields of table sflight.
field-symbols <i> like line of selectedRowIndexTable.
append initial line to selectedRowIndexTable assigning <i>.
<i> = 1.
append initial line to selectedRowIndexTable assigning <i>.
<i> = 3.
append initial line to selectedRowIndexTable assigning <i>.
<i> = 4.
<i><b>Layout</b></i>
<%@page language="abap" %>
<%@extension name="htmlb" prefix="htmlb" %>
<%@extension name="xhtmlb" prefix="xhtmlb" %>
<htmlb:content id="content" design="design2002+design2003" >
<htmlb:page>
<htmlb:form>
<xhtmlb:protectDoubleSubmit timer="1" />
<htmlb:group>
<htmlb:groupHeader>
<htmlb:textView text="SFLIGHT Table: MULTILINEEDIT" />
</htmlb:groupHeader>
<htmlb:groupBody>
<htmlb:tableView id = "tvX"
width = "100%"
visibleRowCount = "8"
selectedRowIndexTable = "<%= selectedRowIndexTable %>"
onRowSelection = "MyEventRowSelection"
selectionMode = "MULTILINEEDIT"
filter = "server"
sort = "server"
table = "<%= sflight %>" />
</htmlb:groupBody>
</htmlb:group>
</htmlb:form>
</htmlb:page>
</htmlb:content>
That's the example in <b>SBSPEXT_TABLE</b>, <i>TableViewMultiLineEdit.bsp</i> -
Multiple line select in TableView
Hello all!
I have this problem while working with Tableview. I have to delete multiple rows at a time but not able to.
I created an instance(<b>lr_tableview</b>) of the class <b>cl_htmlb_tableview</b>. Although the instance is getting loaded correctly, but the selection is not transferred to the server.
Therefore the attribute
<b>lr_table_view->data->prevselectedrowindextable is not</b> getting populated with the indices of the selected rows.It is INITIAL all the time.
Look forward to have some suggestions on how to solve this.
Thanks and regards,
Sukanya.HI
GOOD
GO THROUGH THESE LINKS ,I HOPE YOU WILL GET SOME SOLUTIONS.
http://help.sap.com/saphelp_nw2004s/helpdata/en/fd/003a3c00b96951e10000000a11405a/content.htm
http://help.sap.com/saphelp_nw04/helpdata/en/e2/5c3d651ae911d6b1d100508b6b8b11/content.htm
http://help.sap.com/saphelp_nw04/helpdata/en/d3/4017d9b90afe4999dbf8792638b291/content.htm
THANKS
MRUTYUN -
Multiple rows selection handling in Tableview
Hi guys,
..Good morning ..
I have developed one page for displaying Employees(pernr and Ename) under CEO/VP/Managers using <b>TableView</b>.
Here i have some difficulties.
<b>1.</b> I managed to show Multiple row selection menu
(Selectall/deselectall) right upper corner of
Tableview. but i can also select multiple rows not all
at a time .So in this case ,those selected employees
Overtime amount i want to show in the next page.here
my question is How do i capture selected rows(not all
at a time).
I am using this code ..
<htmlb:tableView id = "tvX"
headerText = "Employee List"
headerVisible = "true"
idth = "30%"
selectedRowKeyTable = "<%= selectedRowKeyTable %>"
onRowSelection = "MyEventRowSelection"
sort = "server"
keepSelectedRow = "TRUE"
selectionMode = "MULTISELECT"
table = "<%= i_emp_1 %>" >
<htmlb:tableViewColumns>
<htmlb:tableViewColumn columnName = "pernr"
width = "10"
sort = "server"
horizontalAlignment = "center"
title = "Emp No"
type = "TEXT" >
</htmlb:tableViewColumn>
<htmlb:tableViewColumn columnName = "ename"
width = "40"
sort = "server"
horizontalAlignment = "center"
title = "Emp Name"
type = "TEXT" >
</htmlb:tableViewColumn>
</htmlb:tableViewColumns>
</htmlb:tableView>
<b>2</b>. How to send one Itab data from one page to
another page.Presently i am using EXPORT/IMPORT
statements.Is this right way or any other method is
there for?.
Could you please look in to this ..
<b>Best regards,
Venkat.O</b>Hi Venkataiah,
See page <b>TableViewMultiSelect.bsp</b> in BSP application SBSPEXT_TABLE.
There is an attribute <b>selectedRowIndexTable</b> in tableView element. you have to assign a table of type INT4_TABLE, and you can fill this table by table_event->PREVSELECTEDROWINDEXTABLE in OnInputProcessing event. For more details see the above mentioned bsp application.
To Export/Import is ok, you can use server-side cookies also, But best way is using model binding. Learn MVC for that.
Hope it solves your problem.
Regards,
Narnder Hartala -
Retriving Data from TableView with a Button Click
Hi,
I have a TableView and a Button. The requirement is that the user can select several rows in the tableview and click the button to process the selected rows. I am using the following logic in OnInputProcessing to retrive the rows selected,
DATA: TB1 TYPE REF TO CL_HTMLB_TABLEVIEW,
tlist1 TYPE REF TO OBJECT.
case event->name.
WHEN 'button'.
CALL METHOD cl_htmlb_manager=>get_data
EXPORTING
request = runtime->server->request
name = 'tableView'
id = 'tvX'
RECEIVING
data = tlist1.
TB1 = tlist1.
Then access TB1->data->prevselectedrowindextable to find out which row indexes the user has clicked in TableView.
However I get error that can't assign type ot tlist1 to TB1.
The return type of tlist1 is TYPE REF TO CL_HTMLB_TABLEVIEW so this assignment should be possible.
But I think the problem is only during runtime is the type of tlist1 knowm. ?
Also, is there a better way to retrive multiple rows from a tableview when a button is clicked ?
ThanksAnand,
<i>But I think the problem is only during runtime is the type of tlist1 knowm. ?</i>
You are correct that ? is the character you are looking for here. In your next quiet moment, spend some time reading ABAP online docs (or in fact any OO like language) on casting.
DATA: tb TYPE REF TO CL_HTMLB_TABLEVIEW,
obj TYPE REF TO OBJECT.
obj = tb.
tb ?= obj.
You need the ? to indicate to ABAP that are casting from an OBJECT to something bigger. Notice that in the other way this is not required.
(If you find the relevant link onto help.sap.com, you can append it here. I don't have it handy at the moment.)
brian
PS: I see that you are new in our small corner of SDN, and would thus recommend that you also look at <a href="/people/brian.mckellar/blog/2004/06/11/bsp-trouble-shooting-getting-help">Getting Help</a>. It helps to keep the learning curve short. -
PREVSELECTEDROWINDEXTABLE is initial??
Hi;
I have a BSP page on which I want to process selected rows. But when I execute my code PREVSELECTEDROWINDEXTABLE is initial. My code is shown below;
LAYOUT:
<htmlb:tableView id = "XX"
headerText = "Search Results"
headerVisible = "true"
footerVisible = "false"
design = "ALTERNATING"
selectionMode = "MULTISELECT"
table = "<%= wx_expenses %>"
selectedRowIndexTable = "<%= selectedRowIndexTable %>"
columnWrapping = "true">
ONINPUTPROCESSING:
TV ?= CL_HTMLB_MANAGER=>GET_DATA(
request = runtime->server->request
name = 'tableView'
id = 'XX'
IF TV IS NOT INITIAL.
TABLE_EVENT = TV->DATA.
SELECTEDROWINDEXTABLE = TABLE_EVENT->PREVSELECTEDROWINDEXTABLE.
SORT SELECTEDROWINDEXTABLE DESCENDING.
ENDIF.
Thanks.
Edited by: ekrem tigli on Jan 15, 2008 10:27 AMHello Ekrem,
There are 2 attributes of selected rows.
1) prevselectedrowindex - previous row that been selected - its inintial cause none of tha row has been selected when a page has been loaded, if you choose another row this value will be filled.
2) selectedrowindex - Curren selected row - this what you should chek in your code.
you use curren code:
IF bp_table_event->selectedrowindex "NOT EQUAL SIGN (has been deleted cecause of a HTML)" bp_table_event->prevselectedrowindex.
ENDIF.
to check if there has been any change of selected row.
Good Luck
Eli Steklov
Please Reward Points if it Helped -
How to display an alert message on click of link in tableview
Hi,
Following is the code for a tableview in layout section of a BSP( i have specified only one tableview column here). The requirement is to display an alert message on click of link in the first column that is "evbeg". Can anyone please help me how to achieve this? Appreciate quick response on this.
CREATE OBJECT lr_dateiterator TYPE cl_lso_bsp_it_trdates
EXPORTING im_application = application
im_tform = trainingform.
<htmlb:tableView id = "dates"
table = "<%= dates %>"
iterator = "<%= lr_dateiterator %>"
width = "100%"
rowCount = "<%= lp_len %>"
footerVisible = "FALSE"
sort = "SERVER" >
<htmlb:tableViewColumn columnName = "evbeg"
type = "user"
title = "<%= otr(LSO_FRONTEND/schedule) %>"
tooltipHeader = "<%= otr(LSO_FRONTEND/schedule) %>"
sort = "TRUE" >
</htmlb:tableViewColum>
Thanks and Regards,
Archana.you have to code in the iterator for this.
in the render_cellstart method of the iterator you need to code.
this is for a column.
when 'MATNR'.
data: text type string.
text = 'disp_alert()'. "this java script i placed in the page
data: lo_link type ref to cl_htmlb_link.
create object lo_link.
lo_link->id = p_cell_id.
lo_link->onclientclick = text.
lo_link->text = <fs>-matnr.
p_replacement_bee = lo_link.
below is the java script i added in my page..
< sc ri pt type="text/javasc ript" >
f u n ction disp_alert()
a l e rt("helloworld");
< /s c ript > -
SIGABRT error when choosing a row of a tableview
Hello, I am creating an iPhone app and I keep getting a "SIGABRT" error. I have a tableview where I want a separate webpage pushed for each rows.
Currently, what happens is that the table displays; however, when I pick a row it gives me a SIGABRT error. Please help.
Here is my first view (table view) .h file:
#import <UIKit/UIKit.h>
@interface videoTableViewController : UITableViewController
NSArray *videos;
@property (strong, nonatomic) NSArray *videos;
@end
Here is my first view (table view) .m file:
#import "videoTableViewController.h"
#import "videoURLController.h"
@interface videoTableViewController ()
@end
@implementation videoTableViewController
@synthesize videos;
- (id)initWithStyle:(UITableViewStyle)style
self = [super initWithStyle:style];
if (self) {
// Custom initialization
return self;
- (void)viewDidLoad
[super viewDidLoad];
videos = [NSArray arrayWithObjects:@"Welcome", @"Hello", @"Goodbye", nil];
// Uncomment the following line to preserve selection between presentations.
// self.clearsSelectionOnViewWillAppear = NO;
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem;
- (void)viewDidUnload
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
return (interfaceOrientation == UIInterfaceOrientationPortrait);
#pragma mark - Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
// Return the number of sections.
return 1;
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
// Return the number of rows in the section.
return [self.videos count];
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
static NSString *CellIdentifier = @"videoCell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
// Configure the cell...
NSUInteger row = [indexPath row];
cell.textLabel.text = [videos objectAtIndex:row];
if (row == 0)
cell.detailTextLabel.text = @"Welcome";
if (row == 1)
cell.detailTextLabel.text = @"What we value";
if (row == 2)
cell.detailTextLabel.text = @"What does Honor mean?";
return cell;
// Override to support conditional editing of the table view.
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
// Return NO if you do not want the specified item to be editable.
return YES;
// Override to support editing the table view.
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
if (editingStyle == UITableViewCellEditingStyleDelete) {
// Delete the row from the data source
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
else if (editingStyle == UITableViewCellEditingStyleInsert) {
// Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
// Override to support rearranging the table view.
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath
// Override to support conditional rearranging of the table view.
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath
// Return NO if you do not want the item to be re-orderable.
return YES;
#pragma mark - Table view delegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
videoURLController *detailViewController = [[videoURLController alloc] initWithNibName:@"videoTableViewController" bundle:nil];
UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
if (indexPath.row == 0){
[webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.google.com"]]];
// Pass the selected object to the new view controller.
[self.navigationController pushViewController:detailViewController animated:YES];
@end
Here is my videoURLController (second view/web view) .h file?
#import <UIKit/UIKit.h>
@interface videoURLController : UIViewController
@property (strong, nonatomic) IBOutlet UIWebView *webView;
@end
Here is my videoURLController (second view/web view) .m file?
#import "videoURLController.h"
@interface videoURLController ()
@end
@implementation videoURLController
@synthesize webView;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
return self;
- (void)viewDidLoad
[super viewDidLoad];
// Do any additional setup after loading the view.
- (void)viewDidUnload
[super viewDidUnload];
// Release any retained subviews of the main view.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
return (interfaceOrientation == UIInterfaceOrientationPortrait);
@endHello, I am creating an iPhone app and I keep getting a "SIGABRT" error. I have a tableview where I want a separate webpage pushed for each rows.
Currently, what happens is that the table displays; however, when I pick a row it gives me a SIGABRT error. Please help.
Here is my first view (table view) .h file:
#import <UIKit/UIKit.h>
@interface videoTableViewController : UITableViewController
NSArray *videos;
@property (strong, nonatomic) NSArray *videos;
@end
Here is my first view (table view) .m file:
#import "videoTableViewController.h"
#import "videoURLController.h"
@interface videoTableViewController ()
@end
@implementation videoTableViewController
@synthesize videos;
- (id)initWithStyle:(UITableViewStyle)style
self = [super initWithStyle:style];
if (self) {
// Custom initialization
return self;
- (void)viewDidLoad
[super viewDidLoad];
videos = [NSArray arrayWithObjects:@"Welcome", @"Hello", @"Goodbye", nil];
// Uncomment the following line to preserve selection between presentations.
// self.clearsSelectionOnViewWillAppear = NO;
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem;
- (void)viewDidUnload
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
return (interfaceOrientation == UIInterfaceOrientationPortrait);
#pragma mark - Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
// Return the number of sections.
return 1;
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
// Return the number of rows in the section.
return [self.videos count];
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
static NSString *CellIdentifier = @"videoCell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
// Configure the cell...
NSUInteger row = [indexPath row];
cell.textLabel.text = [videos objectAtIndex:row];
if (row == 0)
cell.detailTextLabel.text = @"Welcome";
if (row == 1)
cell.detailTextLabel.text = @"What we value";
if (row == 2)
cell.detailTextLabel.text = @"What does Honor mean?";
return cell;
// Override to support conditional editing of the table view.
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
// Return NO if you do not want the specified item to be editable.
return YES;
// Override to support editing the table view.
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
if (editingStyle == UITableViewCellEditingStyleDelete) {
// Delete the row from the data source
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
else if (editingStyle == UITableViewCellEditingStyleInsert) {
// Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
// Override to support rearranging the table view.
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath
// Override to support conditional rearranging of the table view.
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath
// Return NO if you do not want the item to be re-orderable.
return YES;
#pragma mark - Table view delegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
videoURLController *detailViewController = [[videoURLController alloc] initWithNibName:@"videoTableViewController" bundle:nil];
UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
if (indexPath.row == 0){
[webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.google.com"]]];
// Pass the selected object to the new view controller.
[self.navigationController pushViewController:detailViewController animated:YES];
@end
Here is my videoURLController (second view/web view) .h file?
#import <UIKit/UIKit.h>
@interface videoURLController : UIViewController
@property (strong, nonatomic) IBOutlet UIWebView *webView;
@end
Here is my videoURLController (second view/web view) .m file?
#import "videoURLController.h"
@interface videoURLController ()
@end
@implementation videoURLController
@synthesize webView;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
return self;
- (void)viewDidLoad
[super viewDidLoad];
// Do any additional setup after loading the view.
- (void)viewDidUnload
[super viewDidUnload];
// Release any retained subviews of the main view.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
return (interfaceOrientation == UIInterfaceOrientationPortrait);
@end -
Tableview getting refreshed when changing data in the rows
Hi Gurus,
Iu2019m doing a BSP with MVC. The requirement is as below.
In the main page there is a button u2018Create Orderu2019, to create a sales order, once I click this button, another screen (pop up) comes up and within that I have a Tableview display with the below fields with the data of 20 records.
Material no
Quantity
Delivery Date
Here user is allowed to choose the quantity and delivery date by selecting each row.(with MULTISELECT option in BSP)
The issue is after I select first row and change the quantity and date, and if I click on second row, the Tableview gets refreshed to enable the second row to be editable and the changes what I did on the first row are also refreshed.
So i want the Tableview not to be refreshed when selecting the multiple rows. So that I can keep the changes I make to the quantity and date fields Can you please suggest any method.
Cheers,
Srini.Hi Srinivas,
You need to capture the value entered by user in Quantity and date field and update the internal table with these values for the current selected row.
For ex.
The tableView code is like:
<htmlb:tableView id = "material"
headerText = "<%= otr(Z_SUS/HEADER_TEXT_MATERIALS) %>"
headerVisible = "true"
design = "alternating"
onRowSelection = "MyEventRowSelection"
selectionMode = "MULTILINEEDIT"
width = "880"
filter = "SERVER"
emptyTableText = "<%= otr(Z_SUS/EMPTYTABLE_MATERIALS) %>"
iterator = "<%= iterator %>"
table = "<%= gt_materials %>" />
In eventhandler OnInputProcessing :
DATA: lt_fields type tihttpnvp ,
ls_fields like line of lt_fields.
call method request->get_form_fields
changing
fields = lt_fields
Now the internal table lt_fields contains all the editable cell values , just update the internal table of your tableview with these values.
You can try these threads
[Thread-I.|Re: Retrieve changes made in tableView]
[Thread-II|https://forums.sdn.sap.com/click.jspa?searchID=24460585&messageID=5516977]
Search the forum for more information on this.
Regards,
Anubhav -
Issue with tableview data storing
Hi,
We are using MVC model, it has view-model-main controller and sub controller. I am displaying
4 columns on the tableview where 2 columns are editable. when i click update button on the screen
i have called do_handle_event method on sub controller, when i debug the code i am getting
table as initial always. I am not sure what am i missing here..can any one help me ?
Here is code
method DO_HANDLE_EVENT
data: o_event type ref to cl_htmlb_event,
visible_row type int4,
visible_last_row type int4,
visrow_count type int4 value 10,
it_osha like line of it_mfgprf_osha,
wa_osha type zpp1_mfgprf_osha,
o_app type ref to zcl_mfg_perf.
o_event = cl_htmlb_manager=>get_event( request ).
if o_event is not initial.
if o_event->id = 'osha_update'.
data: tv type ref to cl_htmlb_tableview.
tv ?= cl_htmlb_manager=>get_data(
request = runtime->server->request
name = 'tableView'
id = 'it_osha_history' ).
if tv is not initial.
data: tv_data type ref to cl_htmlb_event_tableview.
tv_data = tv->data.
if it_mfgprf_osha is not initial.
visible_row = tv_data->visiblefirstrowindex.
visible_last_row = visrow_count + visible_row - 1.
loop at it_mfgprf_osha into it_osha
from visible_row to visible_last_row.
it_osha-zosha_ytd = tv_data->get_cell_value(
row_index = sy-tabix column_index = 3 ).
endloop.
endif.
endif.
endif.
endif.
view
<htmlb:tableView id = "it_osha_history"
table = "<%=o_app->it_mfgprf_osha%>"
iterator = "<%=o_cont->osha_iterator%>"
headerText = "OSHA History"
headerVisible = "True"
sort = "SERVER"
onHeaderClick = "sort"
visibleRowCount = "10"
width = "100%"
design = "ALTERNATING"
allRowsEditable = "<%=o_app->ALLOW_RECORD_EDIT%>" />
Thanks!
LakshmikandhHi Guys,
Thanks for valuable suggestion. Let me give you over view of application. We have sub-controller
for all views, one controller and one model for those sub controllers and views.
Hi Sebastian,
Are you suggesting to use new model for all table view iterator ?
If i use iterator on that one model i can't use
that for other table view iterator..right ?
Hi raju,
If i get all the values on 'do_handle_data' method in the controller class, can i use that
for other table view iterator if i create a new table view iterator? can i have some
outline(example coding) of passing those values to sub controller ?
Thanks in advance.
Lakshmikandh -
Updation of internal table from tableview
Hi,
I am using a tableview in which coloumn-3(last_days) is editable.After editing it when user pressess on the button SAVE I should capture the changes and update it in database.
But here I am facing a problem.Always the field last_days is being filled with '000' irrespective of the value entered.
The below is the piece of code which I had written:
DATA: tv TYPE REF TO CL_HTMLB_TABLEVIEW,
wa like line of R_GT_VIEW.
tv ?= CL_HTMLB_MANAGER=>GET_DATA(
request = runtime->server->request
name = 'tableView'
id = 'tvx' ).
IF tv IS NOT INITIAL.
DATA: tv_data TYPE REF TO CL_HTMLB_EVENT_TABLEVIEW.
tv_data = tv->data.
loop at R_GT_VIEW into wa .
wa-last_days = tv_data->get_cell_value( row_index = sy-tabix
column_index = '3' ).
modify R_GT_VIEW from wa index sy-tabix.
endloop.
ENDIF.
Helpful answers will be rewarded.
ThanksHi,
Sorry....coz I replied in a haste...
Just to let you know....The method get_cell_value will not work if you are rendering a column as InputField.
Use the below mentioned code and this it should work....
DATA: tv TYPE REF TO cl_htmlb_tableview.
wa like line of R_GT_VIEW.
tv ?= cl_htmlb_manager=>get_data(
request = runtime->server->request
name = 'tableView'
id = 'tvx' ).
IF tv IS NOT INITIAL.
DATA: tv_data TYPE REF TO cl_htmlb_event_tableview.
tv_data = tv->data.
LOOP AT itab INTO wa .
data : if_value type ref to cl_htmlb_inputfield.
data : p_cell_id type string,
row_ix type string.
clear p_cell_id.
clear row_ix.
row_ix = sy-tabix.
condense row_ix.
concatenate p_cell_id 'TV_' row_ix '_3' into p_cell_id. "generating cell ID...Make Sure to use ur TableView Id instead of TV
if_value ?= cl_htmlb_manager=>get_data( request = request
name = 'inputField'
id = p_cell_id
if if_value->value is not initial.
wa-last_days = if_value->value.
endif.
MODIFY itab FROM wa INDEX sy-tabix.
ENDLOOP.
<i>Do reward each useful answer..!</i>
Thanks,
Tatvagna. -
How to read vales from dropdownlistbox placed in tableView Cells
Hi,
Thanks for reply.. I got problem of reading values from Dropdownlist box placed in tableView Cells. Please correct me or give some sample to read vales from dropdownlistbox placed in tableView Cells.
TableView column defined as
<htmlb:tableViewColumn columnName = "OT_REASON_CODE"
title = "OT Reason"
type = "User"
width = "6"
edit = "true" >
<htmlb:dropdownListBox id = "rcode"
table = "<%= I_YH008 %>"
nameOfKeyColumn = "OT_REASON_CODE"
nameOfValueColumn = "OT_REASON_DESC" />
</htmlb:tableViewColumn>
OnInput processing I am trying to read dorpdown list values selected.
W_YH022-ENDUZ = TABLE_EVENT->GET_CELL_VALUE(
ROW_INDEX = SY-TABIX
COLUMN_INDEX = 3 ). " Get time
DATA: data TYPE REF TO CL_HTMLB_DROPDOWNLISTBOX.
DATA: value type string.
value = TABLE_EVENT->GET_CELL_ID( row_index = SY-TABIX
column_index = '7'). " get Cell ID
data ?= CL_HTMLB_MANAGER=>GET_DATA(
request = runtime->server->request
name = 'dropdownlistbox'
id = value
IF data IS NOT INITIAL.
W_YH022-OT_REASON_CODE = data->selection. " +Cell Values...I am not getting cell values here+
endif.Hi:
Do like this
Layout
<htmlb:dropdownListBox id="mydropdownlist" >
<htmlb:listBoxItem key = "bpno"
value = "Business Partner Details" />
<htmlb:listBoxItem key = "bpaddress"
value = "Business Partner Address" />
</htmlb:dropdownListBox>
OnInpurProcessing event - >
DATA: lcl_dropdown TYPE REF TO cl_htmlb_dropdownlistbox.
data : selection2 type string.
lcl_dropdown ?= cl_htmlb_manager=>get_data(
request = runtime->server->request
name = 'dropdownListBox'
id = 'mydropdownlist' ).
IF NOT lcl_dropdown->selection IS INITIAL.
selection2 = lcl_dropdown->selection.
ENDIF.
Regards
Shshi -
"Select All" in tableview does not trigger event?
Hi,
I have a MULTISELECT table, and whenever I use the "Select all" or "Deselect all" feature, I don't seem to be able to capture the resulting event... Whenever I select one line, there's always a "tableView" event being triggered, allowing me to run the following code to recover the selected entries:
me->check_groups = table_event->GET_ROWS_SELECTED(
includeCurrentSelectedRow = 'X' ).
However, when I select all entries, there's not even an event being generated:
event = CL_HTMLB_MANAGER=>get_event( request ).
if event is not initial...
endif.
The above code fails; no event seem to be generated!!
Have I missed out on something; or is this a bug...? I would assume the built-in "select all" would trigger some kind of event... or do we have to check/program this manually?
Trondhi trond,
what i know is that for catching <b>request</b> u have to use <b>runtime</b> object.
so u may try this:
event = CL_HTMLB_MANAGER=>get_event( <b>runtime->server-></b>request ).
might be possible it will solve your problem.
Regards,
kamaljeet -
How to get editable value from thtmlb:tableView
Hi,
I create a tableview using tag thtmlb:tableView and set column editable. Now the value in the tableview can be changed, but I don't know how to get the changed value from tableview. Pls help me.
thanks in advance!Hi,
You can get the collection of the context node and any line of the table is an entity in the context node.
If it is not helpfull try to find a table called 'table' or 'tableview', maye it's an attribute in your context node.
Best regards,
Caíque Escaler
Maybe you are looking for
-
Can we create cursor using the table created dynamically
Dear all, Can we create the cursor using the table which is created dynamically using "Execute immediate" within the same procedure, or is there any way to call the table created dynamically .. please Do Help me in this thanks alot Edited by: khaja o
-
Is there anyway to record the time of a signature on a document?
I work in real estate and timely signatures are very important. Is there anyway to show the time a document was signed on the actual document?
-
Flash player show black screen on playing streaming video.
Hello All, I'm using Bitgravity live stream in flash AS3.0. The video stream work pecfectly in FP 9. I have recently migrated to Flash CS5. I have published my player in Flash player 10. It provide better rendering and high video quali
-
Best Large Format Printer with Aperture 3.1 & 10.6.5??
I have an Epson R1800 and am not pleased with my print results. Prints are too dark and generally lack "pop". I have read through threads here and other places and tried a lot of suggestions ... all to no real improvement. Simple question -- which la
-
Error syncronizing automatically the Scheme
Hi there, Im trying to generate an XML file from my oracle table. I have setup all the physical and logical schema. I have created the model by reverse engineering the XSD and used it in the interface. I have issued the Command Synchronize all on IKM