cancel
Showing results for 
Search instead for 
Did you mean: 

Hide parts of a view

Former Member
0 Kudos

Hello,

I am developing an application using MVC. On one view I need a table because of the data that is in there. But the user doesn't need to see the data in this table. Is there an easy way to hide this table?

Regards

ALEX

Accepted Solutions (1)

Accepted Solutions (1)

maximilian_schaufler
Active Contributor
0 Kudos

Hi Alex,

first please where exactly do you need this data?

Just server-side to control creation of your view's HTML output? Or client-side because you want to submit this data through some form fields? Or even another different way ...?

Former Member
0 Kudos

Sorry for not beeing precisely enough. Here is the whole scenario. I have page1 where I display a tableview with a lot of lines and 4 inputfields per line. This table is bound by data binding to a model-class so I get the values the user entered in the inputfields. On page1 there is a button "save as". When the user clicks this button, I open page2 where he can save the entered values under a special name / version. On this page i currently show the tableView from page1 again, so i have the entered values. And I want to hide this tableView on page2, because it is of no importance for the user. It is just for me, that I have the values.

ALEX

Former Member
0 Kudos

Hello Alexander,

sounds as if the two pages are completely different, why do you include the tableView element on page2 at all? As you got the entered values in your model you can display them everywhere in any view in anyway you like?! Just make sure the controller for page2 (if at all different from page1) gets hold of the model of page1's controller.

Regards,

Sebastian

Former Member
0 Kudos

On page2 the name for the new version is entered, which is then used to save the values from page1 to the database. That's why I need the values again on page2. Or is there a better way?

Regards,

ALEX

maximilian_schaufler
Active Contributor
0 Kudos

You don't need the values of the tableview input fields again on page2, what do you have data binding for then?

After you submit values of page1 you have them stored in the model object, so unless you don't change the values there, you don't need to use them again in a form on page2.

That's a general hint for all web applications, if you keep values on the server (e.g. with a model class), there is no need to place them in every form (just to be submitted again) if they will not be changed on that page.

Hope you get the idea now

Max

Former Member
0 Kudos

Hello Max,

I don't know if I am doing everything right. On page1 the user enteres values. These values are not stored in the db-table, because I have to ask the user for a description for the values, therefore I display page2. If i donot display the values of page1 again on page2 they are lost (I checked it with my application). Maybe I have an error in my thinking. Help appreciated.

Regards,

ALEX

Former Member
0 Kudos

Alexander,

you should bind a model to page1 and this way (automatically) exchange data - i.e. also the entered values - between page1 and this model. You can create a second model (bound to page2) and fill this model with the relevant data from the first model before you display page2. The actual storage of the models' data in the DB can be done later.

The SAP docu on MVC, data binding etc. is quite good, you might consider reading it.

Regards,

Sebastian

maximilian_schaufler
Active Contributor
0 Kudos

First of all make sure about two things for your application:

*) are you running stateful or stateless?

*) are you using just an application class or a "real" model class according to MVC?

Ok, apart from that, here is what you have to distinguish between for your problem:

Values from page1 are sent to server on submitting the form, now you can handle them on the server.

For stateless applications it is ok (one possible way) to place these values again in the next page to have them again in the next response. But as you are using MVC, let's look at the stateful advantages ...

Your model is the place where you can store all your session values, like the values from the form in page1. So, after page1 is submitted, you just assign the values to attributes of your model, then you don't have to place them in page2 again.

After the user entered a description and submitted page2, you just use the data stored in the model.

Where exactly is it that you loose your values? On the way from client to server (form submit), or do you place them in appplication class/model and they disappear there?

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Alexander,

We are all a little lost but I will take a shot in the dark here.

You have a view in your application and on that view you display data, be it text, table whatever and for some users you want them to see it and others not, correct?

You can program into your code an "authorization check", take a look at this link for more info.

http://help.sap.com/saphelp_erp2004/helpdata/en/8d/3e4e19462a11d189000000e8323d3a/frameset.htm

If I am wrong then please provide more info so one of us can help you out.

Former Member
0 Kudos

Alexander, please explain your problem more accurate, <i>..you need a table because of the data that is there. But the user doesn't need to see the data in this table..</i> ??!

Former Member
0 Kudos

Hi

Are u talking abt the tableview?

Naresh