views:

40

answers:

1

I cant figure out whats wrong. Its working when i tried to refresh only topics but it doesnt works when tried to refresh topics and page-links. ie. topics table's refreshing, and 'pagelinks' disappearing, i thought pure cannot reach - read second template node.

By the way, i tested their code, first message box show up all of nodes - includes 'pagelinks' node, but second one - in function only show up topic rows. Its look like a bug. Anyone knows how can i solve this?

ps. I'm using latest version of pure.

Thanks.

Test Code - pure.js line: 189

function dataselectfn(sel) {
    // ...
    m = sel.split('.');
    alert(m.toSource());
    return function (ctxt) {
        var data = ctxt.context;
        if (!data) {
            return '';
        }

        alert('in function: ' + m.toSource());
        // ...

Json:

{"topics":[{"name":"foo"}],"pagelinks":[{"Page":1},{"Page":2}]}

HTML - before pure rendering:

<table>
    <tbody>
        <tr>
            <td class="pagelinks">
                <a page="1" href="/Topics/IndexForAreas?page=1" class="p Page@page">1</a>
            </td>

            <td class="pagelinks">
                <a page="2" href="/Topics/IndexForAreas?page=2" class="p Page@page">2</a>
            </td>
        </tr>
    </tbody>
</table>

HTML - after pure rendering:

<table>
    <tbody>
        <tr>
        </tr>
    </tbody>
</table>

Controller:

    [Transaction]
    public ActionResult IndexForAreas(int? page)
    {
        TopicService topicService = new TopicService();
        PagedList<Topic> topics = topicService.GetPaged(page);
        if (Request.IsAjaxRequest())
        {
            return Json(new {
                topics = topics.Select(t => new {
                    name = t.Name,
                }),
                pagelinks = PagingHelper.AsPager(topics, 1)
            });
        }
        return View(topics);
    }

ASP.NET - View:

<div class="topiccontainer">
    <table>
        <%
            foreach (Topic topic in ViewData.Model)
            { %>
        <tr class="topics">
            <td>
                <%= Html.ActionLink<ForumPostsController>(ec => ec.Index(topic.Name, null), topic.Name, new { @class="name viewlink@href" })%>
            </td>
            //bla bla...
        </tr>
        <%} %>
    </table>
    <table>
        <tr>
            <% Html.Pager(Model, 1, p =>
           { %>
            <td  class="pagelinks">
                <%= Html.ActionLink<TopicsController>(c => c.IndexForAreas(p.Page), p.Page.ToString(), new { page = p.Page, @class = "Page@page" })%>
            </td>
            <% }); %>
        </tr>
    </table>
</div>

Master Page:

    <% Html.RenderAction("IndexForAreas", "Topics", new { area = "" }); %>
    <script type="text/javascript">
        $.post("<%= Html.BuildUrlFromExpressionForAreas<TopicsController>(c => c.IndexForAreas(null)) %>", { page: page },
                function (data) {
                    $(".topiccontainer").autoRender(data);
                },
                "json"
        );
    </script>
A: 

Next time you have a question or a problem about PURE you can post it at: http://groups.google.com/group/Pure-Unobtrusive-Rendering-Engine

In general, you'll get a fast response there.

Mic