function should not change current view - asp.net-mvc-2

I have a form that submits to a function and returns a particular view when certain values are submitted.
However I require it to return nothing when no values are matched, or if values are empty. At the moment, when this happens I am redirected to a blank page.
I require a function to return "something", so the view is not changed.
Returning 'nothing' or 'emptyresult', still yields a blank page.
regards,
Andrew.

You have to return a new view to the browser. If you want to display the same view again as before, then you should redirect to the action which rendered the previous view (RedirectToAction).

Related

Future builder does not updating the passed data when scroll down then back

I am facing a very weird problem.
To clarify first, I have these fields in a document on Firebase
as you can see in the picture, there is a list in the "likes" field containing two users [blackwolf, sweety]
I used Future builder to show these docs,
snapshot.data!.docs[index]["id"] ==
"2022:12:01:07:05:14"
? print(snapshot.data!.docs[index]["likes"])
: print("");
Here I just wanted to print "likes" field where 'id' is equal to 2022:12:01:07:05:14.
Here is the result
Everything works fine.
But when I delete for example 'blackwolf' from "likes" and scroll down on the same page, then scroll up back to the same position it prints this
However, the black wolf has been deleted, but it still prints it. I have to update the page or rebuild it in order to print the data correctly
How can I print the correct data without refreshing or rebuilding the page?

Ionic Back Button Go to Previous Page with Query String

I'm developing an ionic app, I faced a problem where I'm on Page A going to Page B with query string ex:
Page A: #/app/channels-inside?id=30
Page B: #/app/nowplaying
This is where the problem lies. When I click the back button it goes back to the correct page but without the query string (URL becomes #/app/channels-inside. How do I handle this where I want to redirect to previous page with the id in it?
I think you should use it.
AngularJS: $ stateParams
.controller('yourCtrl', function ($scope, $stateParams){
$stateParams.id
})
This cant be achieved with default pop() method as its action is limited to popping the component from navigation array. What you can do is use insert and remove functions of NavController. Insert channel-inside in the navigation stack with the params you want. Then remove now-playing and already existingchannel-inside.
insert(insertIndex, page, params, opts)
Inserts a component into the nav stack at the specified index. This is
useful if you need to add a component at any point in your navigation
stack.
remove(startIndex, removeCount, opts)
Removes a page from the nav stack at the specified index.
Check out the docs.
Edit
Or you could use Events to pass the params
constructor(public events: Events) {}
// in now-playing
function createUser(user) {
console.log('User created!')
events.publish('user:created', user, Date.now());
}
// in channel inside
events.subscribe('user:created', (user, time) => {
// user and time are the same arguments passed in `events.publish(user, time)`
console.log('Welcome', user, 'at', time);
});

Display a Form in front of another Form that is always at the top

I have a Form that stay always on top with FormStyle -> fsStayOnTop, and I did another Form with this same settings. But when I show this other Form, it is showed always behind, and not in front of first Form. So, how I do to the second Form be displayed in front of the first Form?
An owned top level window always appears above its owner. So, make the fsStayOnTop form be the owner of the other form. In VCL terms, that means setting the PopupMode property to pmExplicit, and assigning the PopupParent property.
OtherForm.PopupMode := pmExplicit;
OtherForm.PopupParent := AlwaysOnTopForm;
OtherForm.Show;

Preserve the scroll position of a Page

I have a page with many elements (forms and tables)
When I want add a row in a table I scroll the page to the table, I press a button to add a row, edit the info in a popup and press OK.
Then I insert the new row in the model and refresh() the model.
At this point the page auto scroll at the top, but I don't want this behavior!
I want that the page stay in the same Y position!
I see that sap.m.page has scrollTo function https://openui5.hana.ondemand.com/docs/api/symbols/sap.m.Page.html#scrollTo
but I don't know how take the position before the refresh()
The Page does unfortunately not have an API to get the current scroll position, but the idea is a good one we consider.
As a workaround you could access some private method of the Page - but only if you accept the risk that it breaks with a future version of UI5:
page.getScrollDelegate().getScrollTop()
To make it safer you should verify both methods exist before calling them and also check the returned value for plausibility. Then you are pretty safe that in the worst case it will again scroll to the top in some future UI5 version.
you have to fill the iTime parameter in scrollTo function - e.g. srollTo(100, 1) - then it works
using 0 for iTime does not work

GWT DataTable TextInputCell is not showing the correct value

I have a DataGrid with a TextInputCell column, using a ListDataProvider. When the value in a cell is changed I am creating a RequestContext and calling RequestContext#edit with the original entity for the row that is being edited. I then set the field in the mutable version of the proxy to the value from the edited cell. This all works nicely, and I can save the change successfully to the database. However, on the server I modify the value before saving the change, and send the modified entity (DTO) back to the client. In the Receiver#onSuccess method I store the new entity in the list data provider, and then call ListDataProvider#refresh. But the value that is shown in the DataGrid doesn't change to reflect the modification on the server. I've looked at the value that is supplied to the TextInputCell#getValue method, and it is correct, that is, it is the value that contains the modification applied on the server.
I tried creating another column in the grid that is just a TextCell, and supplied the same value in getValue for that cell; in this case the displayed value is correctly updated by the refresh, reflecting the modified value that was returned from the server.
So, my question is: where does the cell get its value? When I look at the value returned by my TextInputCell#getValue method it appears to be the correct value, but that value is not being shown on the screen (the value shown on the screen is the value that was in the proxy object prior to sending the request to the server).
Note: I looked at this question, but it did not work in my situation.
I have a very similar problem.
I have a page showing a grid with two column: the first one has check boxes instead of text.
The value of the check box is given by:
public Boolean getValue(Item item) {
return selectedItems.contains(item);
}
When the user checks a check box, I store the value in a map (selectedItems).
At the bottom of the page there is a "Clear" button that reset the map and calls the table redraw, but the status of the check boxes does not revert to the original status (i.e. the check boxes stay selected).
Debugging the code I've found that getValue() returns the correct value, but is like the table caches the cells.
The only workaround I have found, without rebuilding the whole table, was to remove the check boxes' cell and add it again on "Clear".
itemsTable.removeColumn(0);
itemsTable.insertColumn(0, makeSelectionColumn());
The method makeSelectionColumn() must return a new cell.