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

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

danidani Posts: 3Questions: 0Answers: 0
edited March 2012 in DataTables 1.9
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:



first name
last name
Role
Email
Phone





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 memberList = emailSurveyListsMgr
.getAppUserListByListId(listId);
Set 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:

} );

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    What does the rendered JSON that is returned look like? My guess is that the required parameters aren't given: http://datatables.net/usage/server-side

    Allan
  • FreeMEMFreeMEM Posts: 2Questions: 0Answers: 0
    you have to change bServerSide: true to false.
  • venkatgouthamvenkatgoutham Posts: 10Questions: 0Answers: 0
    when i given bServerSide : false .. processing not showing........
  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    Link to a test case please: http://datatables.net/forums/discussion/12899/post-test-cases-when-asking-for-help-please-read
  • Ashwini410Ashwini410 Posts: 7Questions: 0Answers: 0
    Thanks FreeMEM.. That worked!
This discussion has been closed.