-
Notifications
You must be signed in to change notification settings - Fork 339
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
view.index contains "Error: #index in nested view: use #getIndex()" #234
Comments
I'm shooting in the dark ere. I updated the above template by replacing all the references to "#index# with "getIndex()". The error message remains the same. I'm baffled. The message talks of using #index where there is no such reference. |
Whoops. Wrong button. This is not closed. |
I reopened. (You wanted it to stay open, right?) I'll look into this during this weekend... |
Yes. Thank you. Don't kill yourself. Work/life balance is important. Warmests Nicole On 15/02/14 17:29, Boris Moore wrote:
|
The index property on the view will have a numeric value on any view that is an indexed view (type "item"), e.g. the views that correspond to the iterated content of a {{for someArray}} block. But a view that corresponding to the content of an {{if}} block, for example, will have the standard warning string as value. That is so that if you write {{:#index}} within that view, it will output the warning telling you to instead write {{:#getIndex()}} - which will actually step up through parent views and find the first view of type "item" and output that index. So the question is what is the element to which you attached your delete handler. (The 'this' within the handler). It it has non numeric index then it is in a nested view, not in an item view. But you can do view.getIndex() to find what the index of the nearest parent item view is. BTW using non-self-closing markup for The following returns a view with and index as expected:
|
Thank you, Boris, for working on this over your weekend. As I understand it what your saying could be summarised as follows:
Is that a fair summary? |
My apologies to those who, like me, care about grammar. I used "your" in the above post when it should have been "you're". |
Yes, that is fair. To add a couple of details/clarifications, the context you are referring to is called a view, and is an instance of the rendered content of a block tag. {{for}} tags against array iterate against the array, and create a view for each item. Those views are 'item' views and have index properties. |
Closing - since this was a question, now answered, not an issue. |
If I have the following in a template:
There is a helper function ~subs, that merely returns the concatenation of all its arguments, separated by underscore.
The handler for id=address_add_... is
The handler for id=address_delete_... is
The difficulty is that view.index contains "Error: #index in nested view: use #getIndex()"
I've plainly misunderstood something. Could you help?
The text was updated successfully, but these errors were encountered: