Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82528

Showing 1 to NaN of NaN entries (filtered from NaN total entries)

$
0
0
Hi, please I want to know why it shows all the data in just one page???
this is the message that is showen in the footer of the page:
"Showing 1 to NaN of NaN entries (filtered from NaN total entries)"
it's like doesn't know the size of the datatable,
below you find the code that I use.
Thanks a lot in advance ;)
Html:
<table id="viewMem" class="display">
<thead>
<tr>
<th>first name</th>
<th>last name</th>
<th>Role</th>
<th>Email</th>
<th>Phone</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
Javscript:
$('#viewMem').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sAjaxDataProp": "appUserList",
"bDestroy": true,
"sPaginationType": "full_numbers",

"sEcho": 2,
"iTotalRecords": 1,
"iTotalDisplayRecords": 1,
"aoColumns": [
{ "mDataProp":["firstName"] },
{ "mDataProp":["lastName"] },
{ "mDataProp": ["role"] },
{ "mDataProp": ["email"] },
{ "mDataProp": ["phone"] }
],
//"sAjaxSource": "emailGroupManager.htm?action=view&listId="+listId,
"fnServerData": function ( sSource, aoData, fnCallback ) {
/* Add some extra data to the sender */

$.getJSON("emailGroupManager.htm", {action: 'view', listId: listId }, function (json) {
/* Do whatever additional processing you want on the callback, then tell DataTables */


fnCallback(json)

} );
}

JSON:


List<AppUser> memberList = emailSurveyListsMgr
.getAppUserListByListId(listId);
Set<Role> roleSet;
RoleLang roleLang;
String role = "";
appUserList = new JSONArray();
for (AppUser au : memberList) {
roleSet = au.getRoles();
role = "";
for (Role r : roleSet) {
roleLang = roleMgr.getRoleLangByRoleIdAndLanguageId(r
.getId(), loggedInUser.getPrefLanguage()
.getId());
role += roleLang.getRoleName() + ", ";
}
if (role != null) {
role = (role.trim()).substring(0, role.length() - 2);
}
appUserList.add(new EmailModel(au.getFirstName(), au
.getLastName(), role, au.getEmail(), au
.getWorkPhone()));
}
if (appUserList != null) {
//out.write("{\"Member\":[");
out.write("{\"appUserList\":");
appUserList.writeJSONString(out);
//out.write("},");
out.write("}");
// appUserList.writeJSONString(out);
}

EmailModel:
private String firstName;
private String lastName;
private String role;
private String email;
private String phone;
private String city;
private String postalCode;

/**
* @param firstName
* @param lastName
* @param email
* @param workPhone
* @param city
* @param postalCode
*/
public EmailModel(String firstName, String lastName, String role,
String email, String phone) {
this.setFirstName(firstName);
this.setLastName(lastName);
this.setRole(role);
this.setEmail(email);
this.setPhone(phone);
}

/*
* (non-Javadoc)
*
* @see org.json.simple.JSONStreamAware#writeJSONString(java.io.Writer)
*/
@SuppressWarnings("unchecked")
public void writeJSONString(Writer out) throws IOException {
LinkedHashMap obj = new LinkedHashMap();
obj.put("firstName", firstName);
obj.put("lastName", lastName);
obj.put("role", role);
obj.put("email", email);
obj.put("phone", phone);
obj.put("city", city);
obj.put("postalCode", postalCode);
JSONValue.writeJSONString(obj, out);
}
EmailModel:

} );

Viewing all articles
Browse latest Browse all 82528