#1 2017-03-06 10:43:01

Antonio.Cambule
Member
Registered: 2017-02-19
Posts: 38

[solved]: Get value change event of html input inside a ReportControl?

Hi David,

I've put an

  <input id="MyInput" type="text" value="[Record.MyValue]"></input>

inside the html property of an Report Control.

Now i don't want to catch the click like it is used in many samples:

  If "[MyReport.Event.target.id]" "==" "MyInput"

But i want to catch the event when the value is changed. Is that possible?

Thanks and regards
Antonio

Last edited by Antonio.Cambule (2017-03-06 14:39:06)

Offline

#2 2017-03-06 12:46:23

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,657
Website

Re: [solved]: Get value change event of html input inside a ReportControl?

Hello Antonio,

Various things to be considered here. Certainly, look at the below code, which can be placed in the HTML property of a Report control:

<td>
 <input id="RecordInput{{Record.ID}}" type="text" ng-model="Record.Name"
  ng-change="$parent.ReportInputChange(Record.ID)" class="form-control input-md"></input>
</td>

Looking at the above code we find various things:

1º We use "RecordInput{{Record.ID}}" for the input's ID. In this way we get valid IDs for every input, since our inputs IDs become "RecordInput1", "RecordInput2", etc.

2º We introduce the "ng-model" attribute (from AngularJS), which is required if we plain to use the "ng-change" one.

3º As you can see in the below attached app sample, the "ReportInputChange" app's function is called when the input model/value change.

4º But we really need such app's function? Maybe, but, note that the model, that is, the "Record.Name" variable, changes automatically when we changes it in the input control. In other words, if we take a look at the "Report.Data" variable after change the input's model/value, we can see that variable reflect the changes, without our intervention.

Take a look at this application sample: ReportInputs.zip, and tell know if you you have any further questions Antonio.

P.S. The "Report17" app sample also shown us how to use an specific app's function when a Report's record's link is clicked.

Offline

#3 2017-03-06 14:38:19

Antonio.Cambule
Member
Registered: 2017-02-19
Posts: 38

Re: [solved]: Get value change event of html input inside a ReportControl?

Hi David,

thanks a lot. That's great. To point 4, i need it in order to do value validation and change the value to something valid, if it doesn't fit.
I got it to work. The report control is such a great thing. I could style and change into the behaviour we had in mind. Doesn't mean that it is good ;-), but it's great to have this freedom.

As always good support, thanks
Antonio

Offline

#4 2017-03-06 14:42:01

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,657
Website

Re: [solved]: Get value change event of html input inside a ReportControl?

Hello Antonio,

Always thanks you! smile

Offline

#5 2017-03-06 14:59:31

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,657
Website

Re: [solved]: Get value change event of html input inside a ReportControl?

Hello again!

One more thing. Maybe what we need is not the ID of the Report's record, because in fact this ID must be provided by our Report's source, but, may we not always have a field like that. Fortunatelly we can use the "index" of the records, which is always available and, in fact, reflect exactly the position of the record in the Report's Data variable.

We can use some code like the below one:

<td>
 <input id="RecordInput{{$index}}" type="text" ng-model="Record.Name"
  ng-change="$parent.ReportInputChange($index)" class="form-control input-md"></input>
</td>

... instead of the above. In this case what we receive and use is the record's index (in the Data variable) and not any record's ID field.

Hope this can help in some manner too.

Offline

Board footer

Powered by FluxBB


Copyright ©2018 DecSoft. All rights reserved.