|
21.10.2007, 07:21 | #1 |
Участник
|
Kashperuk Ivan: List panels in Dynaics AX - a short description of SysListPanel class
Источник: http://kashperuk.blogspot.com/2007/1...-ax-short.html
============== SysListPanel class – what is it? Whenever a user needs to select a number of values from a certain list, so that the selected list gets processed and saved, a list panel can be used. Another use of this type of control is when you are assigning certain properties/options to a specific object. A good example is the “Administration\Users” form, where each user is assigned to one or more user groups, giving him certain access to DAX functionality. Here is how it looks: SysListPanel is the basic class for a large hierarchy of classes showing different list panels throughout the application. The hierarchy tree for this class is shown below (DAX 4.0 SP2): One important thing you need to understand when working with list panels – the class is not enough. :) When there is a class, there is a form, containing the list panel and using this class. But, of course, the class is responsible for most of the things happening when a user works with list panels. SysListPanel or SysListPanelSet – which class to use? When I consider, what class to extend when creating a list panel on a form, I start off by figuring out how the selected data is going to be stored. If the data selection is supposed to be reflected in the database (for example, when we add the user to a user group, a record is created in UserGroupList table), then extending from SysListPanel should be your choice in most cases. SysListPanelSet is already an extension of the SysListPanel class, and has one extra variable declaration – inSet variable of type SET. This is the entity that is going to store the values a user selects in the list panel. They can, when selected, be used for further processing. The SysListPanelSet_TableBrowser class, used in the DEV_SysTableBrowser project (http://www.axaptapedia.com/DEV_SysTableBrowser) is an example, using this set to create the selected controls in the browser. You should also notice from the SysListPanel hierarchy tree, that there are a lot of classes already available in the application, so it is wise to re-use one of the existing classes, if it matches your requirements or extend from one of them and not from the base class. Again, the SysListPanelSet_TableBrowser class is an example, as it is extending from the SysListPanelSet_Fields class. It uses the functionality of this class to get the data about table fields, extending them with information about display methods and interaction with the browser form. Creating a list panel – what methods need to be implemented? Let’s say the SysListPanelSet_TableBrowser class does not exist yet, and we are just planning to create it, along with the form. Creating the form is the easy part. There are not many requirements that have to be fulfilled here. First of all, of course, you need to have a variable to reference your listPanel class. Put it in the classDeclaration of the form, so that it is visible in all form methods. And after that all that is left to do is to create an object of your listPanel class, and the class will do the rest of the work. Here is what needs to be done:
The class is the handler of these events in most cases, controlMethodOverloadObject method is used to specify that when the list panel is built. I guess, the only two methods left that are worth mentioning are the abstract methods addData and removeData. Both of these have to be implemented in the child class, providing the logic for adding and removing items from the left part of the list panel. For example, for SysListPanelSet class the implementation is very simple, just adding or removing the item from the inSet object. For classes extending directly from SysListPanel these methods are where the main logic is located, adding or removing records from the database. In most cases, these methods simply call a server method that does all the needed actions (Remember the rule of thumb – place database logic as close to the database layer as possible). That is pretty much all you need to know to use and create list panels in Dynamics AX. Conclusion Of course, this is not a full description, and much can be added to the information posted here. If you have any additions, corrections or questions, feel free to post them as comments. See also \Forms\Tutorial_SysListPanel Источник: http://kashperuk.blogspot.com/2007/1...-ax-short.html
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|
21.10.2007, 22:51 | #2 |
Участник
|
Вот небольшое дополнение на русском языке - описание методов класса SysListPanel.
|
|
|
За это сообщение автора поблагодарили: Logger (7). |
|
|