留言板

Autofields - iteration number

Lee Chamberlain,修改在7 年前。

Autofields - iteration number

Junior Member 帖子: 92 加入日期: 16-5-5 最近的帖子
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,修改在7 年前。

RE: Autofields - iteration number

Expert 帖子: 252 加入日期: 12-4-6 最近的帖子
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,修改在7 年前。

RE: Autofields - iteration number

Expert 帖子: 252 加入日期: 12-4-6 最近的帖子
Here's the source for reference. auto_fields.js
Lee Chamberlain,修改在7 年前。

RE: Autofields - iteration number

Junior Member 帖子: 92 加入日期: 16-5-5 最近的帖子
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,修改在7 年前。

RE: Autofields - iteration number

Expert 帖子: 252 加入日期: 12-4-6 最近的帖子
That sounds like a bug.

Could you file a ticket with detailed reproduction steps?
Lee Chamberlain,修改在7 年前。

RE: Autofields - iteration number

Junior Member 帖子: 92 加入日期: 16-5-5 最近的帖子
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,修改在7 年前。

RE: Autofields - iteration number

Expert 帖子: 252 加入日期: 12-4-6 最近的帖子
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,修改在7 年前。

RE: Autofields - iteration number

Junior Member 帖子: 92 加入日期: 16-5-5 最近的帖子
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,修改在7 年前。

RE: Autofields - iteration number

Junior Member 帖子: 92 加入日期: 16-5-5 最近的帖子
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,修改在7 年前。

RE: Autofields - iteration number

Expert 帖子: 252 加入日期: 12-4-6 最近的帖子
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