Skip to main content
1-Visitor
July 11, 2019
Solved

Select items in widgets with JS

  • July 11, 2019
  • 1 reply
  • 1718 views

Who can I select items in widgets like "select" or "list" via javascript?

I want to achieve something like, click a next button and select the next item in a list.

 

Can I somehow utilize the "clickitem" event, or simulate a click otherwise to select a specific item in the list?

Best answer by feil

I found the solution myself.

 

twx.app.fn.clickItemInRepeater = function(item,list,isMultiSelect);

 

1 reply

feil1-VisitorAuthorAnswer
1-Visitor
July 15, 2019

I found the solution myself.

 

twx.app.fn.clickItemInRepeater = function(item,list,isMultiSelect);

 

21-Topaz I
July 17, 2019

Fine solution. But to be more understandable for other members I will to add some details

1.) how to find this function if you have no idea where to look for it.

so simple printing of object in the chrome debugging console

e.g. 

console.warn($scope.app.fn);

 

 

2019-07-17_18-40-15.jpg

 

2.) So here we can print first the $scope and from there we can search for some other functionality  here $scope.app.fn

Now to check if this work we can define the following functions:

 

$scope.app.fn.clickItemInRepeater = function(item,list,isMultiSelect)
//other name for twx.app
{

 console.log("twx.app.fn.clickItemInRepeater item"); console.warn(item);
 console.log("twx.app.fn.clickItemInRepeater list"); console.warn(list);
 console.log("twx.app.fn.clickItemInRepeater isMultiSelect"); console.warn(isMultiSelect);

}; 
 
$scope.app.fn.clickItemInSelect= function(list,isMultiSelect,value,valueField)
{

 console.log("$scope.app.fn.clickItemInSelect list"); console.warn(list);
 console.log("$scope.app.fn.clickItemInSelect isMultiSelect"); console.warn(isMultiSelect);
 console.log("$scope.app.fn.clickItemInSelect value"); console.warn(value);
 console.log("$scope.app.fn.clickItemInSelect valueField"); console.warn(valueField);
 

}; 
 

3.) And test in the console windows of chrome

3.1)  clickItemInRepeater funciton for dataGrid and repeater widgets

2019-07-17_18-51-13.jpg

3.2) and for the slect widget:

 

2019-07-17_18-50-35.jpg