Extending custom SmartForm control with SmartObject filter properties like picker control

  • 11 April 2014
  • 2 replies
  • 1 view

Badge

We are building a smartforms control and we want to extend the datasource property where we can attach a SmartObject. We want to use the filter / lookup functionality but it is not available. We think we are missing some settings in the xml definition file.

We want to have the functions for filtering which are in the standard picker control.

Does anyone have code examples or a sample project which we can use?


2 replies

Badge +7

Hi,


This document covers how you can use Custom Controls to extend the functionality and look of standard K2 smartforms


http://help.k2.com/helppages/K2smartforms1.02DevRef/webframe.html#K2_smartforms_Custom_Controls.html


 


This documemt covers what can be done data sources in k2, look at the limitations and what is possible and see how you can work around configuring data sources: http://help.k2.com/helppages/K2smartforms1.0.5/SF_-_ViewControls_-_Drop-Down_List.html


 


Have a look at these and see if they help


 


Kind regards


Nelly

Badge +10

This is somewhat copypasta, but I think it's a sstart.  Posting here so that it may help others down the line.


 


1.      In your Definition.xml file, add the following section:

<Prop ID="DataSourceType" friendlyname="Type" type="complex" serverControlType="property" category="Data Source" InitializeServerControl="initializeAssociationPropertyConfig" ClearServerControl="clearComplexPropertyConfig" ServerControl="SourceCode.Forms.Controls.Web.PropertyConfiguration.AssociationPropertyConfig, SourceCode.Forms.Controls.Web" />


    <Prop ID="FixedListItems" friendlyname="Items" type="string" serverControlType="property" category="Data Source" ReadOnly="true" />


<Prop ID="AssociationSO" friendlyname="SmartObject" type="string" serverControlType="smartobject" category="Data Source" ReadOnly="true" />


 <Prop ID="AssociationMethod" friendlyname="Method" type="string" serverControlType="listmethod" category="Data Source" ReadOnly="true" />


<Prop ID="ValueProperty" friendlyname="Value" type="string" serverControlType="property" category="Data Source" ReadOnly="true" />


<Prop ID="DisplayTemplate" friendlyname="Display" type="string" serverControlType="property" category="Data Source" ReadOnly="true" />


 


2.      In your control.cs file, add the following section:


 


public string DataSourceType{   


            get


            {


                return this.DataSourceType;


            }


            set


            {


                this.DataSourceType = value;


            }


        }


 


You will want to repeat this "DataSourceType" function for each property needed.

Reply