Editable picklist column
Posted By: nicocrm on March 12th, 2013 in Saleslogix
No Gravatar

By default the PickList column in SalesLogix 8 can display picklist values but not edit them.

Making it editable is a relatively easy process though:

  • The column must be marked as editable (Application Architect will not let you edit that one by default). You can accomplish that by editing the form’s XML.
  • The template needs to be edited to correctly output that editable flag (by default it is hard-coded to false). You can find the template under Model\QuickForms\Web\QFSDataGrid.WebControlScriptRenderingTemplate.vm, do a search for “PickListCol”, and change the “editable: false” to “editable: $generator.GetJavascriptBoolString(${col.IsEditable})
  • A little snippet of javascript needs to be added to ensure the grid is able to load the picklist widget – this can be loaded via a load action on the quickform:
    ScriptManager.RegisterStartupScript(this, GetType(), "PicklistColumn",
            // note the extra "require" for dijit is to account for the fact that 
            // the picklist file is not correctly requiring the base class
        @"require(['dojox/grid/cells/dijit'], function() {          
            require(['Sage/UI/Columns/PickList'], function(PickList) {
                PickList.extend({
    		getWidgetProps: function(val) {    
    		    return { pickListName: this.pickListName };
                    },
                    formatNode: function(inNode, dataItem, inRowIndex) {
                        // apply the properties corresponding to the current row to the widget 
                        // (by default the grid just reuses the same widget for all rows in the column)
                        this.inherited(arguments);
                        if(this.widget) {
                            this.widget.comboBox.set('value', dataItem);                    
                        }
                    }
                });
            });
        });", true);
    

I’m sure in the next version of SalesLogix this will be available by default.


2 Responses to “Editable picklist column”

  1. PatrickNo Gravatar says:

    This looks like it works, but actually it has a bug. If you have more than one row, the first one you click in will show the control with the current value, but then any row you click after that changes to the last value selected regardless of what was in the cell before the click.

  2. nicocrmNo Gravatar says:

    Patrick, you are quite right – I tested on 8.1 and got the behavior exactly as you describe. It still saves the values correctly once you edit them but that makes it very easy to inadvertently change the picklist value. I suspect the customer never noticed because in 99% of the time they select the same country for all products in the grid. We’re actually taking this customer to 8.1 very soon so I may have the opportunity to work on a fix – if I can I will update this post with it. I have updated the post above with a corrected code snippet that addresses the problem you mentioned. Please do let me know if you experience any additional problem with it.

Leave a Reply