Flash Builder Data Passing between Split Views - apache-flex

I have a SplitViewNavigator with two split views. In one of the views I have a list and in another one I have questions. User must solve the question and when user click send button, he will see another question.
But when user click to send button in one view, how can i know this in the other view? I'm a newbie in Flash Builder and I'm searching for this for hours.
Thanks for any help

There are many ways to do this. One is through the view using bubbling events, but that way is not recommended since you're not mixing business level behaviour with UI behaviour. I would recommend that you look at application frameworks for Flex, like RobotLegs or Parsley which definitely does stuff like this very easily.

Related

Symfony2 - Dynamically modify form using user inputs

A little bit of background first. I learned in the past how to use "pure" php, and have more recently started using Symfony. I have been following several guides (Cookbook, Lynda & Openclassrooms) for many of my inquiries, but I haven't been able to find an answer for my current question.
I have two entities, let's name them User and Player. The User entity contains a Player property which can be null.
So, during a User creation, I would like 3 possibilities : leave the Player field empty, select an already-existing player, or create a new Player. At first I wanted to add a "Create new" option in the Player dropdown list, but have simply gone for a "Create new Player" checkbox.
The idea is, if the checkbox is checked, I would like to remove the Player dropdown list and add an embedded form to create a new Player. I have tried several events (PRE_SET_DATA, PRE_SUBMIT & co), but none seem to trigger according to a user input.
This is something that I would have done in JScript, but seeing how Symfony's a much different animal than pure php, I don't know how to do it. Any help or advice would be greatly appreciated !
You're on the right track there with PRE_SET_DATA and PRE_SUBMIT events.
You need to use JavaScript to reload form from server and Symfony form events to rebuild the form.
This is the documentation you're looking for: http://symfony.com/doc/current/cookbook/form/dynamic_form_modification.html
Unfortunately, Symfony's form component is pretty complicated, so there are no simple code examples you can just take and use it without going through this article.
Also reading Form Events documentation is helpful for deeper understanding.

.NET Grid using paging - search and scroll to result

I have an ASP .NET web application. I'm fairly new to .Net but a longtime SQL and Java programmer. I have a requirement to implement a search feature as it is currently implemented in the legacy application. There is a pageable grid of data displayed and a search box. You type your search criteria and the grid pages to the first match. A "next match" button pages to the next item etc. This way the user sees where their search item falls in the hierarchy of the data. I have seen examples where the search criteria filters the data, limiting the data results. This is not what I need.
Can someone please point me in the right direction for this? Is it possible with .NET?
I have some crazy custom ideas but I don't want to reinvent the wheel.
Edit - To clarify, is there an existing .Net control or functionality that does this?
You said this was an existing application and that you normally write Java, so I would presume the existing app is written in Java. Java and C# are very similar, so you could almost write the one side by side from the other.
As for the logic of how to do this, how does the existing app do it? Why reinvent the wheel? You've only been asked to recode the logic into a new platform. Don't give up the years of experience the existing solution provides.

Having a UI layer and presentation layer

Let's say I'm on a list page and I
page to, say, page 10. Then I select
a record on that page and redirect to detail
page. After that, I click on the edit
to redirect to the edit page.
After I update the record I'm redirected back to
the detail page. I, then, press back
to go back list to continue my browsing from
where I left off. The key here is
where I left off in the list which is
page 10.
What is the best way to handle this?
Initially, I put a hidden field called page number in each of the webforms and pass it along with the querystring back and forth. Seemed like a lot or a bit redundant checking the querystring on each page and passing it.
I was wondering if there are some other ways. for instance, I've been reading about a separation between the UI and the presentation layer is a good idea (for larger scale apps). To me I understand it as all click handler events will yield control over to the presentation layer which is just a plain class?
Is this correct? Also, is the presentation layer suppose to implement something particular? I know this could probably be saved in session but could someone humor me and show me how to use a presentation layer to handle this (I know it would be overkill but is it possible?)
I don't think there is THE best way. Everything depends of what you achieve to do, ie. the requirements of the whole project.
After all, according to the description, I don't even understand why are you having three pages to do a single thing. By the way, ASP.NET data controls handle mostly everything for you, so you don't even have to ask yourself how to do this (except if you have serious reasons to avoid ASP.NET controls).
For example, a simple <asp:ListView /> will let you list items page per page and show details when a single item is selected. Edition of an element is also quite easy.
What you are asking for is well... large and could span multiple blog posts to give a complete understanding of UI Design Patterns.
I have a small example of MVP with Asp.Net here: What is the best way to reuse pages from one website in another?
However, it is not exhaustive. If you really want information on this you should do some looking into a framework such as WebForms MVP, or ASP.Net MVC.
Check out ASP.NET MVC. It is a framework which goes on top of ASP.NET to do the separation between the presentation layer and business layer.
For simplicity, what you are describing is a very good example of the perfect place to use Asp.Net Dynamic Data.
It's incredibly easy and powerful, and easy to modify once you dig into it a bit. I'd start with the videos here: http://www.asp.net/dynamicdata
I've been using this more and more on every project, for at least the simple CRUD portion of it. I really can't express how much I love this tool now that I'm used to it.

A newbie question on cairngorm

I am very new to Flex (started learning a couple of days back), I now have some understanding on how to create user interfaces with Flex and how to do MVC with Cairngorm and I really started liking it. But I am still lost with changing views using Cairngorm or entirely in Flex. Being a Java/J2EE developer for more than 10 years, it helps me understanding new technologies comparing it with Java. Typically in java world or in any MVC framework, the controller once got the updated modal it redirects or sets the new view to the user. Lets say once I added a new movie to movie database, I want to show the user a view Movie screen and when he deletes a movie I want to take user to list of all movies. The example which I have seen so far(including the diagram explorer) are just changing the modal values and the data is updating in the same view (using [Bindable]), but my question is how to change the view depending on the result or if it's a fault I want to take user to a different screen. How to do that in flex and in Cairngorm. Are there any best practices available and somebody please point me to right direction/resource. Thanks in advance.
The usual way to do this with Cairngorm is to put the data about the state of the application (eg. the screen the user is on) in the model too. You can, for example, use the ViewStack as the main container of the different parts of your application and bind it's selectedIndex to a variable in the model which will be used to control the screen that is displayed to the user. Putting it shortly - the state of the application is a reflection of the model.
You may also want to take a look at the Mate framework. We recently switched to Mate after using Cairngorm because we found it was a much easier framework to use and understand.
For your example, you would have a faultHandler event listener that would call whatever method you wanted in your model. You could easily use that to show or hide whatever you needed to.

user controls and asp.net mvc

Here is one trivial question, that I am not sure how to handle.
I need to display list of categories on every page, and to be able to choose items from a specific category to be displayed. I use asp.net MVC, and have chosen to create a user control that will display categories. My question is: what is the best approach to pass data to a user control. I already found some information in these blog posts:
http://weblogs.asp.net/stephenwalther/archive/2008/08/12/asp-net-mvc-tip-31-passing-data-to-master-pages-and-user-controls.aspx
http://blog.matthidinger.com/2008/02/21/ASPNETMVCUserControlsStartToFinish.aspx
I would like also to hear your opinion.
PS. I'd like to hear Jeff's opinion, especially because of his experience with UC's on Stackoverflow
I'm using mvc components, which replaced ascx user controls in preview 4.
Example:
http://blog.wekeroad.com/blog/asp-net-mvc-preview-4-componentcontroller-is-now-renderaction/
So, you call components action from View, which then choose View to render. You can pass data in this call also.
it is the mvc futures project. i will probably try this
http://forums.asp.net/t/1303328.aspx. I need to render menu with categories.

Resources