Solved

SmartForms Listing Custom Control

  • 21 August 2017
  • 7 replies
  • 21 views

Hi All,

 

I am busy creating a listing custom control with a smartobject as datasource. The control renders custom html to present the control. 

 

My problem i am facing is that i want to refresh the datasource on a button click event, thus i implement the rule: "populate list control with data" and specify my filter on the smartobject, thus it should render the control again using the filtered smartobjet, but it doesnt.

 

Thanks

Marius

 

 

icon

Best answer by Mariusvb82 4 September 2017, 13:41

View original

7 replies

Hi Marius, Can you share more details about your problem? are you trying to use a build a custom control? are you using the K2 list control? if you can also share some screenshot about what you're trying to do that'd be great. 

HI Mohamed,

 

I am busy creating a ChartJS control. I am not going to share allot of my code now, will do if necessary. I am just going to share the important bit now to show how i want the control to work: 

 

In design time the graph looks like this:

 

So my problem is that when i click the button i am expecting the render event to be called again with the pre-filtered smartobject.

Hi All,

 

I have finished my implementation of this control and is working like a charm.

 

Will be uploading the control to the community site soon.

 

Thanks

Here is a link to the Custom Control: http://community.k2.com/t5/K2-blackpearl/ChartJS-SmartForm-Control/ba-p/99324

Hi all,

 

i have the Same Problem. Can someone help me with the Solution. When i call the Populate the Control with the Data, the javascript method - populate is not called.

 

My Definition.xml:

 

<?xml version="1.0" encoding="utf-8" ?>
<ControlType>
<FullName>RowControl</FullName>
<Category>Listing</Category>
<Group>Custom</Group>
<Name>SpreadsheetRowControl</Name>

<GetPropertyMethod>RowControl.getProperty</GetPropertyMethod>
<SetPropertyMethod>RowControl.setProperty</SetPropertyMethod>
<GetValueMethod>RowControl.getValue</GetValueMethod>
<SetValueMethod>RowControl.setValue</SetValueMethod>

<PopulateMethod>RowControl.populate</PopulateMethod>

 

Designer:

 

 

and my Javascript &colon;

 


RowControl = $.extend({}, SourceCode.Forms.Controls.Base.ControlType,
{
//internal method used to get a handle on the control instance
_getInstance: function (id) {
//console.log("_getInstance(" + id + ")");
var control = jQuery('#' + id);
if (control.length == 0) {
throw 'SpreadsheetRowControl '' + id + '' not found';
} else {
return control[0];
}
},

 

// init the control.
init: function (id) {
debugger;
var instance = RowControl._getInstance(id);
var control = jQuery('#' + id);
console.log('id' + id);
control.on('change', function () {
alert('rendered');
});

},
populate: function (objInfo) {
alert('in populate');
}

 

The Javascript method populate is never called.

 

Any Ideas??

 

Thanks for ur replies

I am having the Same Problem,  I saw the Chart Control but doesn't understand how the .js method is being raised when we are calling the Populate the List Control with data from the Designer. 

 

Any Ideas will be really appreciated.

Hallo all,

 

i finally found the Solution:

 

In Definition.xml

 

<?xml version="1.0" encoding="utf-8" ?>
<ControlType>
<FullName>BasicControl.myControl.control, myControl</FullName>
<Category>Listing</Category>
<Group>Custom</Group>
<Name>Control</Name>

<GetPropertyMethod>BasicControl.myControl.getProperty</GetPropertyMethod>
<SetPropertyMethod>BasicControl.myControl.setProperty</SetPropertyMethod>
<GetValueMethod>BasicControl.myControl.getValue</GetValueMethod>
<SetValueMethod>BasicControl.myControl.setValue</SetValueMethod>

<SetItemsMethod>BasicControl.myControl.populate</SetItemsMethod>

 

And then  in .js

 

populate: function (objInfo) { 

alert('populated');

}

 

objInfo.XmlDocument.xml  has the filtered data from Populate List Control Method. 

 

 

 

Reply