Thursday 4 September 2014

Ax 2012 Model-driven list pages

list pages:-
The following list describes the sequence of high-level steps that you can follow to create a model-driven list page:
1. Start the Development Workspace.
2. Create a new Form in the AOT, and set the FormTemplate property to ListPage. This will au-tomatically add some design elements, such as the filter, grid, and Action Pane.
3. Set the query on the form to get the data to be displayed in the form.
4. Set the DataSource on the grid to the required data view.
5. Add the fields to display in the grid.
6. Create and add an Action Pane and info parts, if required. Ideally, you should create one info part to be displayed in the Preview Pane (below the grid), and one or more info parts, form parts, and cue groups to be displayed in the FactBox area (to the right of the grid). The Pre-view Pane should display extended information about the selected record, and the FactBoxes should display related information. To link these parts to the list page, you will need to create the corresponding display menu items.
7. Create a display menu item that points to the form. Right-click the menu item, and then click Deploy to EP.
8. When prompted, select the module that you want to deploy the page to.
This will automatically create a SharePoint Web Part page for the list page for Enterprise Por-tal. It will also create a URL web menu item and import the corresponding page definition into the AOT.
9. Set the HyperLinkMenuItem property on the first field in the grid to a display menu item cor-responding to a details page. This will render links in the first column that can be used to open up the record by using a linked details page. (Note See the next section for information about how to create a details page).
For more information about list page development, see List Page Reference on MSDN.
To achieve more control over how your model-driven list page behaves, you can specify a custom interaction class by using the InteractionClass property on the form. This is discussed in more detail in later sections.

Details pages:-
A details page in Enterprise Portal displays detailed information about a specific selected record.
The following list describes the high-level steps that you can follow to create a details page:
1. Start Visual Studio, and use the EP Web Application Project template (found under the Mi-crosoft Dynamics AX category) to create a new project.
2. Add a new item to the project by using the EP User Control with Form template (found under the Microsoft Dynamics AX category). This will also automatically add the control to the AOT.
3. Switch to design view, select the AxDataSource control, and set the DataSet name.
4. Select the AxForm control, and ensure that DataSourceID is set to the AxDataSource.
5. Set the DataMember and DataKeyNames properties on the form as appropriate.
6. If required, change the default mode of the form to Edit or Insert (it is ReadOnly by default).
7. To auto generate the Save and Close buttons:
a. In ReadOnly mode: Set AutoGenerateCancelButton to true.
b. In Edit mode: Set AutoGenerateEditButton to true.
c. In Insert mode: Set AutoGenerateInsertButton to true.
d. Select an AxGroup control, and ensure that the FormID property is set.
8. Click the Edit Fields link, and add the required fields to the AxGroup control.
9. Compile the EP Web Application by using the Build menu. Ensure that there are no errors. This will also automatically deploy the control to the SharePoint directory.
10. Start the Development Workspace, and navigate to \Web\Web Content\Managed.
87
11. Right-click the Managed item that maps to the web user control that you have created, and click Deploy to EP.

12. When prompted, select the module to deploy the page to.
This will automatically create a SharePoint Web Part page for Enterprise Portal and put your web user control on the page by using the User Control Web Part. It will also create a URL web menu item and import the corresponding Page Definition into the AOT.
13. Select the URL web menu item that you created for the page, and set the WindowMode prop-erty to Modal. This will cause the details page to open in a modal window.
14. Create a new Display Menu Item, and set the WebMenuItemName property to the URL Web Menu Item that is linked to the details page.
15. Use this Display Menu Item to link to the details page from the list page grid, as described in the “Model-drive list pages” section.
Enterprise Portal has also made it very easy to implement a variety of interaction patterns by using modal win-dows. This is discussed in more detail in later sections.

List page interaction classes
initialized Called after the list page has been initialized.
 initializing Called when the list page is initializing.
 selectionChanged Called when the list page selection changes.
 setButtonEnabled Enables or disables buttons. This method is called from the selection-Changed method.
 setButtonVisibility Displays or hides buttons. This method is called when the form opens.
 setCaption Changes the form caption. This method is called when the form opens.
 setGridFieldVisibility Shows or hides grid fields. This method is called when the form opens.
 setListPageType Used to identify the type of list page when you work with secondary list pag-es.
 setModeledQueryName Replaces the query. This method is called when the form opens.
http://dynamicsax.contoso.com/sites/DynamicsAx/Enterprise%20Portal/?RUNONCLIENT=1&IsDlg=1.
https://dynamicsaxgyan.wordpress.com/2012/01/06/one-click-deploy-to-ep-ax-client-forms-using-menu-items-in-dynamics-ax-2012/

Enterprise Portal 2009:-
Creating a dataset
First of all, let's have a look at how we create datasets in AX that we will later use by
the .NET controls.
The datasets defined in the AOT are used by the AxDatasource control in ASP.NET
to fetch data from AX and send data back again when updated in a data binding
enabled ASP.NET control.
A dataset can be considered a replacement of the Datasource node in the web forms
and web reports. As web forms and web reports will eventually be phased out from
AX, we should now use a dataset to connect the fields in our .NET forms to fields in
AX tables.
1. To create a dataset, open the AOT and browse to Data Sets. Right-click on Data Sets and select New Data Set.
2. Right-click on the new dataset and select Properties to show the properties window. Then change the Name property to RentalDataSet.
3. Go to the Data Sources node under the dataset and add a new data source by right-clicking on the Data Sources node and selecting New Data Source.Open the properties window for the new data source and change the table and name property to RentalTable.

Creating a new Visual Studio project
Before you start creating a Visual Studio project, make sure that the Enterprise Portal
development tools are installed on the same computer as Visual Studio.
1. To create a new project in Visual Studio, open Visual Studio and select File | New | Web Site.
2. In the form that opens, select Dynamic Data Web Site, change the name, and click on the OK button.

You are now good to go with a new web site project in Visual Studio. You will use this project for the rest of the examples in this chapter.

Creating a grid
Follow these steps to create a grid control in ASP.NET that retrieves data:
1. Right-click on the website in the Solution Explorer in Visual Studio and select Add New Item.
2. Select Dynamics AX User Control and give it a name that makes sense.
3. Now that the control has been created, right-click on it in the Solution Explorer and select Add to AOT.
4. When that is done, the control is saved in the AOT under Web | Web files |Web controls. This step has to be performed in order to use the user control from the SharePoint page.
5. Open the user control and add an AxDataSource control to the user control simply by dragging it into the design view.
6. Click on the arrow to the right-hand side of the AxDataSource control in the design view and change the DataSet Name property to the dataset you just created in AX.
7. You can also do this by right-clicking on the control and selecting Properties to open the properties window. From here you can also change the rest of the parameters, as shown in the next screenshot.
8. Now, go to the toolbox and drag the AxGridView control onto the design view.
9. Click on the arrow to the right of the control to select the most important properties.
10. The next thing to do is to set the Data Source property to the data source that you have just created.
11. Also, if you would like the users to be able to edit or delete records from the grid, you have to check the Enable Editing or Enable Deleting checkboxes.
12. You can't insert records from a grid by using the AxGridView control.Instead you can add action in a toolbox that opens a tunnel or wizard that lets the user create a new record.
13. Next, click on the Edit Columns link to select the columns from the data source that you want to use in the grid.
14. Available display and edit methods are also shown in the list of fields. Select all the fields in the list except the dataAreaId, TableId, and RecId. Then click on the OK button.

The grid is now ready to be used by a web part page.

Creating a new Web Part page
To create a web part page, make sure you have installed and set up Enterprise Portal.
1. Start by opening the Enterprise Portal in a web browser. Click on the Site Actions button in the upper-right corner, and then click on the Create button, as shown in the next screenshot.
2. In the page that opens, click on the Web Part page under the Web Pages group.
3. The next page will ask you for the name of the page, what template you would like to use, and in which document library you would like the page to be stored in.
Name the page CarRental and select the template called Header,Left Column, Body and store the page in the Enterprise Portal document library.
4. The page will now open in edit mode where you can add web parts.Add a new web part by clicking on the Add a Web Part button under the body section.
5. In the window that opens, find and select the Dynamics User Control Web Part and click on the Add button.
6. When you are back in edit mode, click on the Edit button in the new web part and select Modify Shared Web Part.
7. In the property window, you will find the user control you created in the list of Managed content item as shown in the next screenshot:
8. Once you have selected it, scroll down to the bottom and click on the OK button. Back in the edit mode, you can click on the Exit edit mode link in the top-right corner to see what the page looks like.
The web part page should now look something like :
You
You have now created a SharePoint page with a grid that lists records from the
RentalTable where users can edit and delete records.
The next thing to do is enable users to enter new records as well. From a user point
of view, I would say that I should have been able to do this directly from the grid,
but since that won't work we can create a tunnel (also known as a wizard) to
achieve this.

No comments:

Post a Comment