Kaspatoo
Kaspatoo

Reputation: 1363

row-attribute not working any more after changing to server-side processing

I changed my datatable to server side processing. From this point on the row attribute seem to not working any more.

This is my definition of the datatable within the JSP:

<datatables:table id="users" url="/user_User_Json_List_Dandelion.action" serverSide="true" row="user">
        <datatables:column titleKey="user.user.list.username" sortable="false" property="benutzername" />
        <datatables:column titleKey="user.user.list.prename" sortable="false" property="person.vorname" />
        <datatables:column titleKey="user.user.list.surname" sortable="false" property="person.nachname" />
        <datatables:column titleKey="user.user.list.email" sortable="false" property="person.email" />
        <datatables:column cssCellClass="img" sortable="false" cssCellStyle="width: 40px">
            bla<c:if test="${user.gesperrt}">
                <img src="<%=request.getContextPath()%>/static/images/locked.gif" title="<s:text name="%{getText('user.user.list.locked')}"/>"
                    alt="<s:text name="%{getText('user.user.list.locked')}"/>" />
            </c:if>
            <c:if test="${!user.aktiv}">
                <img src="<%=request.getContextPath()%>/static/images/delete.gif" title="<s:text name="%{getText('user.user.list.delete')}"/>"
                    alt="<s:text name="%{getText('user.user.list.delete')}"/>" />
            </c:if>
        </datatables:column>
        <datatables:column cssCellClass="img" sortable="false" cssCellStyle="width: 20px">
            <c:if test="${!user.systemBenutzer}">
                <s:url var="edit" action="user_User_Edit_Pre">
                    <s:param name="benutzerId">${user.benutzerId}</s:param>
                </s:url>
                <s:a href="%{edit}" title="%{getText('user.user.edit.header')}">
                    <img src="<%=request.getContextPath()%>/static/images/edit.gif" title="<s:text name="%{getText('user.user.edit.header')}"/>"
                        alt="<s:text name="%{getText('user.user.edit.header')}"/>" />
                </s:a>
            </c:if>
        </datatables:column>
        <datatables:column cssCellClass="img" sortable="false" cssCellStyle="width: 20px">
            <s:url var="listRights" action="user_Auth_List_Pre">
                <s:param name="benutzerId">${user.benutzerId}</s:param>                   
            </s:url>
            <s:a href="%{listRights}" title="%{getText('user.user.list.listRights')}">
                <img src="<%=request.getContextPath()%>/static/images/user_details.gif" title="<s:text name="%{getText('user.user.list.listRights')}"/>"
                    alt="<s:text name="%{getText('user.user.list.listRights')}"/>" />
            </s:a>
        </datatables:column>
    </datatables:table>

all calls like e.g. '' do not work, theres no user-variable available since I turned server side processing on.

My Json Result from the Json WebService does look like:

{"data":[{"aktiv":true,"benutzerId":"8a2fde263d8b94000144020a7e066fa5","benutzername":"adm_boegel","gesperrt":false,"systemBenutzer":false},{.....

So whats going wrong here? How else can I access the data?

Thanks for any help.

Edit:

just for testing I changed one of the columns to:

<datatables:column cssCellClass="img" sortable="false" cssCellStyle="width: 40px">
                hello
        </datatables:column>

'hello' is never printed out in none of the about 2500 lines.

Edit2:

whenever setting to server side I only can access data via

when not using server side I also can use row attribute and things like ${user.gesperrt}

Maybe its a bug?

Upvotes: 0

Views: 49

Answers (1)

Kaspatoo
Kaspatoo

Reputation: 1363

as described in a previous chapter in the doc

8.3. Customizing column contents

One only can use of column tags using the property-property and my use the renderFunction-property to call java script which then may processes some logics. But in my observation these java script calls returning some html (like an img-tag) is slowing down the rendering.

I hope in the end server side processing will although make some benefits in speed.

My dandelion datatables column then looks like:

        <datatables:column property="aktiv" renderFunction="produceUserLockedIcon"/>

and my java script looks like:

<script type="text/javascript">
    function produceUserLockedIcon(data, type, full) {

        return "testString: " + '<a href="blaa">blaa</a>' + '<img src="<%=request.getContextPath()%>/static/images/locked.gif"\>';
    }
</script>

Upvotes: 0

Related Questions