Forums de discussion

Autofields - iteration number

Lee Chamberlain, modifié il y a 7 années.

Autofields - iteration number

Junior Member Publications: 92 Date d'inscription: 05/05/16 Publications récentes
When I'm using Autofields is there an easy way to get which iteration of the field is? (IE a #3 for the third clone of the form fields I'm duplicating).

I need to perform a calculation (with jquery) on some of the fields, but can only perform it on the original fields at the moment.

Thanks
Lee
thumbnail
Byrån Zaugg, modifié il y a 7 années.

RE: Autofields - iteration number

Expert Publications: 252 Date d'inscription: 06/04/12 Publications récentes
I don't believe this is supported out-of-the-box.

You might be able to get something from the private property _guid, as it increments as you add rows. Not sure about that though.

You could also extent AutoFields, with your own component, and override the method addRow(), to add some count reference. But this may get messy, because you also may need to code for removeRow(), and sortable rows.
thumbnail
Byrån Zaugg, modifié il y a 7 années.

RE: Autofields - iteration number

Expert Publications: 252 Date d'inscription: 06/04/12 Publications récentes
Here's the source for reference. auto_fields.js
Lee Chamberlain, modifié il y a 7 années.

RE: Autofields - iteration number

Junior Member Publications: 92 Date d'inscription: 05/05/16 Publications récentes
Thanks

I'm also now having problems with datepickers in the autofileds.

I'm using liferay-ui:input-date but whenever I try to use the datepicker in the automatically generated field I'm not able to, and it just remains set as mm/dd/yyyy

Is this a known issue too?

Lee
thumbnail
Byrån Zaugg, modifié il y a 7 années.

RE: Autofields - iteration number

Expert Publications: 252 Date d'inscription: 06/04/12 Publications récentes
That sounds like a bug.

Could you file a ticket with detailed reproduction steps?
Lee Chamberlain, modifié il y a 7 années.

RE: Autofields - iteration number

Junior Member Publications: 92 Date d'inscription: 05/05/16 Publications récentes
Byrån Zaugg:
That sounds like a bug.

Could you file a ticket with detailed reproduction steps?



Unfortunately I don't have an account to raise such an issue.
thumbnail
Byrån Zaugg, modifié il y a 7 années.

RE: Autofields - iteration number

Expert Publications: 252 Date d'inscription: 06/04/12 Publications récentes
Please write detailed replication steps, with code examples if necessary, here than. I'll create the ticket and share the link here.

FYI, if you sign-up for a Jira account, you'll be able to track the progress of the ticket easily.
Lee Chamberlain, modifié il y a 7 années.

RE: Autofields - iteration number

Junior Member Publications: 92 Date d'inscription: 05/05/16 Publications récentes
I've got a datepicker working now.


I'm still having issues with getting an iteration number so I can do JQuery calculations on fields.


Thanks
Lee
Lee Chamberlain, modifié il y a 7 années.

RE: Autofields - iteration number

Junior Member Publications: 92 Date d'inscription: 05/05/16 Publications récentes
Is there any documentation on this? The lack of available information to help me work this out for myself is astonishing.

I am writing a shopping cart, for each row of items (which I'm using auto fields for) i need to multiply the quantity with the unit cost and populate a third input with the total.

There is nothing available online to show me how to identify each clone of the item row in order to make the calculation possible
thumbnail
Byrån Zaugg, modifié il y a 7 années.

RE: Autofields - iteration number

Expert Publications: 252 Date d'inscription: 06/04/12 Publications récentes
Lee Chamberlain:
Is there any documentation on this? The lack of available information to help me work this out for myself is astonishing.

I am writing a shopping cart, for each row of items (which I'm using auto fields for) i need to multiply the quantity with the unit cost and populate a third input with the total.

There is nothing available online to show me how to identify each clone of the item row in order to make the calculation possible


You are correct. Our documentation is lacking.

We are working on improving our coverage. Infact, your forum post initiated a ticket for this specific module.


It needs additional content, and is still in review. But we hope, over time, our documentation meets the needs of developers like yourself.

You can see the current, in progress, doc here: https://github.com/mwilliams2014/liferay-docs/blob/50ff0754f57e65255e16c67055364511cf4bf7d6/develop/tutorials/articles/244-liferay-js-api/using-liferay-auto-fields.markdown