How to refresh only modified rows in ALV grid? - abap

I have task to refresh only modified rows in ALV grid. I know that the grid is refreshed via method
CALL METHOD l_grid->refresh_table_display
EXPORTING
is_stable = ls_stbl
EXCEPTIONS
finished = 1
OTHERS = 2.
But it refreshes the whole grid only.
Is there any method which allows to refresh certain grid lines?

Outside of the DATA_CHANGED event in edit mode, that is not supported.

I have same problem but in my scenario, i was using function module REUSE_ALV_GRID_DISPLAY. If i pass refresh command on FM it refresh whole grid display. So i solved it using user command "#REFRESH". after making changes in internal table i called #refresh. This help me solve issue of refreshing whole grid. it refresh with only row which made changes.

Related

Using BackgroundWorker to fetch data

I used the data sources tab to drag and drop some fields from my database onto a form. This created the reqired textboxes/fields/designer components and also created a fill command by default, which is expected.
On my form load event, the following command takes place:
Me.TblQueueTableAdapter.dt_FillIncompleteCases(Me.BE_DataSet.tblQueue)
This command can take a while to fill on the end user's PC. I would like to display something in the meantime while the data is being retrieved so I added a new borderless form which will show before the fill event, then hide after completion.
So the problem as it stands is the main thread is being blocked due to the database fill code above, and my main thread will not display the borderless form. The process of showing and hiding works, but because the thread is blocked, the content of the borderless form is blank. I need to stop the main thread from blocking.
I know I can probably use a background worker to get this data out of the database. I could instantiate a new table adapter and use the fill command in the do work event. If I do this, I canpass back the datatable through e.result but I dont know how to set the datatable to my designer controls. How do I do this?
In the run worker completed event, I imagined something like:
Me.BE_DataSet.tblQueueDataTable = e.result
But this is a type and cannot be set in this way. What do I need to do?

silverlight domain datasource refreshed only after F5

I am using SL4 with WCF RIA services. I have a domain datasource which I am using to populate a listbox.
I have attached a context menu attached to the list items that I want to trigger an update to a fields value in the database.
so I am trying
EmployeeDetail employee = (EmployeeDetail)sender;
if(employee.EmployeeDetails!=null)
employee.formEmployee.CommitEdit();
dsEmployee.SubmitChanges();
So the code works ok I see the update in the database, however the listbox hasn't been refreshed. If I press F5 then I see the change in the silverlight application however what do I need to do to refresh the lists datasource?
The question is a little bit vague. If your listbox is bound to a collection of EmployeeDetail objects, and they are entities, they will be wrapped in an IObservableCollection<EmployeeDetail>, which means that your listbox should be updated whenever your list is updated in the code behind. However, if you really need to refresh manually, I find that this works:
IObservableCollection<EmployeeDetail> temp = employeeListBox.ItemSource;
employeeListBox.ItemSource = null;
employeeListBox.ItemSource = temp;
If you want to manually refresh a DomainDataSource, you can use the Load() method. If you want to do it on every successful submission, you can subscribe to the SubmittedChanges event and immediately invoke a load.

How do I force a page to refresh the data upon reload after entering new record

When I create a new record by submitting an .aspx page the new record is not showing up. I have to navigate away from the page and back to it for the new data to show.
How do I refresh the data up reload??
i think you need to call databind() on your grid. If that's an unlucky guess, we're going to need more context - can you please post your code (aspx and vb)
try Application.doEvents() right after you update the object in your code.
It's a shot in the dark really since we really don't know what you're code is doing, but if I ever have problems with something updating in VB.net, 9 times out of 10 calling that method fixes it.
You will need to call DataBind() on whatever object your using for your data connection, and then you will have to refresh the page unless your using AJAXified controls inside of an UpdatePanel that has a trigger set to your submit button. But without a code listing, knowing how your talking to the database, or anything of that sort, its really hard to give any code that will help.

ASP.NET Keep fileupload after postback

I'm writing an intranet ASP.NET page using VB.NET. I've run into a particularly nasty problem dealing with handling file uploads. I'll do my best to explain the problem, and perhaps someone can help.
My problem is almost a duplicate of this one, or this one, except (other than the filename) I don't care about sending the file to the server until the other data has been reviewed.
Here's the situation:
Joe Q. Dataentry inputs some data into several fields. The first 3 are drop down, and when he changes the selection, a postback event is fired that queries a database for valid entries for the other drop down selections. After selecting the values, he inputs some other data, chooses a file to accompany the data and clicks the "Update" button. When he hits the button, it fires a postback event that sends the current data to the server to be validated. The data will create a change in the database, so he is presented with a view of the current state, and what it will look like when his changes are made. He can now either confirm or cancel the operation for whatever reason.
Part of the data he will see involves the extension of the file which may be a PDF, or could also be some image file or other document.
Now here's where my problem is - on each postback event, the fileupload dialog is cleared. I was getting around it by creating a temporary file on the first postback and then renaming if he clicks OK or deleting on Cancel... but I need to do a variety of things, based on the previous state of data and the filename. I've tried to keep some session variables to retain the filename, and that works OK for just renaming the file, but for what I need to do it gets unwieldy.
What I want to do is be able to have the postback event to present the changes, and then when the user clicks "OK", submit the file. Is there any possible way to do that?
One of my thoughts was to do some of the validation client-side (I'm already re-validating server side so I'm not too worried about data security there), but I don't know how I could get the information from the database query.
Thanks for any help, and reading my slightly convoluted story/situation!
EDIT:
It appears that what I want to do is prevent a certain button from firing a full postback. Is there any way to do that?
EDIT II:
I have an update panel on the page already - is there any way for the button to only post what's in the update panel?
What you might want to do is place your drop-downs inside of an ASP.NET AJAX UpdatePanel, and keep your file upload control out of that.
Your update panel will do the post backs and allow your validation logic to happen without submitting the file, then when you hit your final "Save" button (which is also outside of your UpdatePanel) the entire form will be submitted back and you can work with your file then.

Informing the user that a DataGridView is being populated

I am writing a program in VB.Net to manage text messages sent through an API. It allows you to view messages in a datagridview and filter by date, sent/unsent etc...
To load the messages I'm executing an SQL statement and retrieving a DataTable which then gets set as the DataSource for my DataGridView control.
The problem is that depending on the filters selected the user could be selecting a lot of records and it would take some time for the DataSource to update. I want to inform the user of this load time by providing a progress bar or label of some kind.
I have used progress bars before when looping through data but this is loading it all at once. I thought of displaying a label when the user clicks to load the data and then hiding it when the data is loaded. But this happens instantaneously even when the data is still loading.
Is there an event on the DataGridView I can use perhaps? Something like .DataSourceLoadStart and .DataSourceLoadFinished.
I know I'm just making those events up... but hopefully it makes it clearer as to what I want.
You could set the label to be visible when load is clicked and try the: DataGridView.DataBindingComplete Event to hide it, this event gets called when the binding is complete.
MSDN Link - DataBindingComplete
A little off topic but... I wonder if you could attach a AJAX update panel with activity/loading image to a gridview? I don't think I've ever seen it done but here's a great application for it.