Skip to Content
avatar image
Former Member

Get element inside a table on controller

Hello I am trying to get an element on controller function. Easy task right? I am having problems to deal with it.

XML Code:

<Table id="tableLlaves" growingScrollToLoad="true" growing="true" items="{modelDefault>/DetalleStockDuplicadosSet}" headerText="Llaves (*)">
	<Column width="100px" minScreenWidth="Tablet" demandPopin="true"> 
			<Label text="Tipo Llave"/>
	<Column width="100px" minScreenWidth="Tablet" demandPopin="true"> 
			<Label text="Confirmar"/>
		<Text text="{modelDefault>Descripcion}"/>
		<CheckBox id="checkBox" selected="{modelDefault>Confirmada}" enabled="{path: 'modelDefault>/enabled', formatter: '.checkBox'}" select="onCheck"/>

JS Function:

checkBox: function (oItem) {
	//var o = s.getSource();
	//var t = s.getMetadata().getName();
	if(oItem) {
		//var o = oItem.getSource();
		var a = oItem.getBindingContext();
		return false;
	return this.getView().getModel("modelDefault").getProperty("/enabled");

The method getSource is not working either getBindingContext.

Somebody knows some way to get the checkbox which I do click on?


Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • May 04, 2018 at 06:50 AM

    Hey ..

    First of all the checkBox is you formatter function which will not give event properties in the parameter so oItem.getSource() and oItem.getBindingContext() don't make sense here ... the parameter of this function will give the path value bind to the property enabled of the check box control ..

    If you need the element in the formatter function than you can't get through parameters like you get in the event handler functions .. in this the only way to get the control is through ID of the control ... this.getView().getId("<id of check box control>")..

    But why do you want control in the formatter function ??



    Add comment
    10|10000 characters needed characters exceeded

    • If the requirement is to enable and disable on the basis of check box value ..

      than why to use the formatters for that .. Just use expression binding on the enables property like this ..

      enabled = "{= ${modelDefault>Confirmada} === false}"



  • May 03, 2018 at 05:12 PM

    what you get ?

    Add comment
    10|10000 characters needed characters exceeded

  • May 04, 2018 at 07:10 AM

    Hello Diego

    Formatter should not be used in case of events . Event functioned name mentioned in XML code is "onCheck" . Please write the below code under onCheck function and it would provide you the value

    onCheck: function(oItem)

    { oItem.getParameter("selected") ;


    Add comment
    10|10000 characters needed characters exceeded