Solved

Reading Datalabel Value from ListView's Column

  • 23 July 2017
  • 1 reply
  • 40 views

Badge +4

Hi all,

 

I have added a datalabel column in listview and applied some very basic html to display checkbox in that column using expression. These checkboxes can be checked and unchecked. But when I click the "Update Services" toolbar button I did not find any easy way to read the values of these checkboxes row by row. Kindly guide me how to do that with some sample code.

There could be an option for doing that using click event of this checkbox using javascript in expression, assign its checked/unchecked value to the next column's cell. But how to access the current row and next using javascript in expression.

 

I will be grateful for your guidance and help. 

 

 

Thanks and Regars

 

15251i1BEE579200685E37.png


12881i90371FA7D01F631F.png

icon

Best answer by Albarghouthy 24 July 2017, 14:34

View original

1 reply

Userlevel 5
Badge +16

Hi Asad,


 


I was able to get the checkbox value but you'll need 'For Each' to loop through the list items and get the checkbox value


Use the following script to read the checkbox value for each row:


 


<script type="text/javascript">
$(".grid-body-content-wrapper tbody tr").each(function(index) {

var listItem= JSON.parse($(this).find("td").eq(0).attr("data-options"));
var pos = $(this).index();

if (listItem.value == "ListItemID") {
if ($("[name = 'CheckBoxName']").eq(pos).prop("checked") == true) {
$("[name='dlCurrentRowValue']").SFCLabel('option', 'text', 'True');
} else if ($("[name = 'CheckBoxName']").eq(pos).prop("checked") == false) {
$("[name='dlCurrentRowValue']").SFCLabel('option', 'text', 'False');
}

}

})
</script>

 


I am not sure how your rules are configured, please find attached video (Open in IE) to see how I used the script.

Hope that helps


 

Reply