Skip to content
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

Inverted section with DataTable doesn't evaluate correctly #92

Closed
trousyt opened this issue May 11, 2015 · 1 comment
Closed

Inverted section with DataTable doesn't evaluate correctly #92

trousyt opened this issue May 11, 2015 · 1 comment
Assignees
Labels
Milestone

Comments

@trousyt
Copy link

trousyt commented May 11, 2015

When trying to use a DataTable that has zero rows, the inverted tag doesn't evaluate correctly (i.e. not at all). Here's an example of my template:

    <table>
        <thead>
            <tr>
                <th>Foo</th>
            </tr>
        </thead>
        <tbody>
            {{#Data}}
            <tr>
                <td>{{Foo}}</td>
            </tr>
            {{/Data}}
            {{^Data}}
            <tr>
                <td>
                    No data exists.
                </td>
            </tr>
            {{/Data}}
        </tbody>
    </table>

I get simply:

    <table>
        <thead>
            <tr>
                <th>Foo</th> 
            </tr>
        </thead>
        <tbody>
        </tbody>
    </table>

My call looks like so:

Render.FileToString("path_to_template.html", new {
    <other properties...>,
    Data = dt
});
@trousyt trousyt changed the title Inverted tag with DataTable doesn't evaluate correctly Inverted section with DataTable doesn't evaluate correctly May 11, 2015
Romanx added a commit that referenced this issue May 13, 2015
@Romanx
Copy link
Collaborator

Romanx commented May 13, 2015

Hey, thanks for reporting this. It was an oversight on my part when implementing the DataTable interpolation in that it has to have an explicit way to determine if it has values.

I've added code to fix this and added a test using your example (which was well documented, thank you very much for that) and it'll in the next release which should be on Friday by the latest.

Thanks,

@Romanx Romanx added the bug label May 13, 2015
@Romanx Romanx self-assigned this May 13, 2015
@Romanx Romanx added this to the 1.15.1 milestone May 13, 2015
@Romanx Romanx closed this as completed in e354a97 May 16, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants