Page 1 of 1

Custom ComboBox - Sales Order Lines and PO Lines

PostPosted: Thu Mar 23, 2017 12:52 pm
by Atronics
I have a number of custom ComboBoxes setup in a plugin, all of which work correctly except for SO_Lines and PO_Lines. The combo box appears on the form but does not display a pick list. Is there a setting I need to make to correct this?

Re: Custom ComboBox - Sales Order Lines and PO Lines

PostPosted: Thu Mar 23, 2017 3:23 pm
by Mike.Sheen
You need to define in the plugin what items appear in the drop-down.

For Combo custom fields on the lines this is done in the FormatCell method of the LineCustomFieldPlugin class - and that code needs to be present in the same plugin that defines the custom field.

The code is fairly simple - you just need to set the Items and ItemData properties of the cell to be a string array of possible values:

Code: Select all
public void FormatCell(JiwaFinancials.Jiwa.JiwaApplication.IJiwaBusinessLogic BusinessLogicHost, JiwaFinancials.Jiwa.JiwaApplication.Controls.JiwaGrid GridObject, JiwaFinancials.Jiwa.JiwaApplication.IJiwaForm FormObject, int Col, int Row, JiwaFinancials.Jiwa.JiwaApplication.IJiwaLineCustomFieldValues HostItem, JiwaFinancials.Jiwa.JiwaApplication.CustomFields.CustomField CustomField, JiwaFinancials.Jiwa.JiwaApplication.CustomFields.CustomFieldValue CustomFieldValue)
{
   // Set the drop-down items for our custom field
   if (CustomField.PluginCustomField.Name == "ComboTest")
   {
      var itemData = new List<string>() {"10", "20", "30"};
      var itemDisplay = new List<string>() {"Red", "Green", "Blue"};
               
      if (GridObject.ActiveSheet.Cells[Row, Col].CellType == null)
         GridObject.ActiveSheet.Cells[Row, Col].CellType = GridObject.ActiveSheet.Columns[Col].CellType;
      
      FarPoint.Win.Spread.CellType.ComboBoxCellType comboCell = (FarPoint.Win.Spread.CellType.ComboBoxCellType)GridObject.ActiveSheet.Cells[Row, Col].CellType;
   
      comboCell.ItemData = itemData.ToArray();
      comboCell.Items = itemDisplay.ToArray();
   }
}



Sample plugin attached (7.00.175.00).

Re: Custom ComboBox - Sales Order Lines and PO Lines  Topic is solved

PostPosted: Thu Mar 23, 2017 3:55 pm
by Atronics
Thanks for the prompt reply, Mike. That should get us on our way.