Friday, November 9, 2012

Dynamics Ax multiselect grid

For reference: http://www.axaptapedia.com/index.php?title=Multiple_grid_selections

I wanted to test this out here are the steps to produce with a twist thrown in for Active on the datasource.

  1. Create a new form, called TestMultiSelect
  2. copy CustTable to the data source
  3. under design,
    1. add a grid,
      1. on grid copy "Invoice" field group to the grid
    2. add a button
      1. on the button select Multiselect = Yes
  4. code for the buttons clicked event see Figure 1
  5. on active code override of the datasource custtable put code for figure 2
  6. That is it, now you have a multiselect button and a way while form is loaded to check things like should the button be lit up or not in the active method.
   1: void clicked()
   2: {
   3:  
   4:     custTable   currentCustTable;
   5:     ;
   6:     super();
   7:  
   8:     for (currentCustTable = custTable_ds.getFirst(true) ?
   9:                                     custTable_ds.getFirst(true) :
  10:                                     custTable_ds.cursor(); currentCustTable; currentCustTable = custTable_ds.getnext())
  11:     {
  12:         info(currentCustTable.InvoiceAccount);
  13:     }
  14:  
  15: }

Figure 1


 



   1: public int active()
   2: {
   3:     int ret;
   4:     CustTable currentCustTable;
   5:  
   6:     ret = super();
   7:     
   8:     for (currentCustTable = custTable_ds.getFirst(true) ?
   9:                                     custTable_ds.getFirst(true) :
  10:                                     custTable_ds.cursor(); currentCustTable; currentCustTable = custTable_ds.getnext())
  11:     {
  12:         info(currentCustTable.InvoiceAccount);
  13:     }
  14:  
  15:  
  16:     return ret;
  17: }

Figure 2

No comments:

Post a Comment