problem with showing entries

problem with showing entries

danidani Posts: 3Questions: 0Answers: 0
edited March 2012 in General
Hi,
do you have any idea about this error, it shows all the data in just one page (112 records) ?
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)"
Thanks,
Dani.

Replies

  • danidani Posts: 3Questions: 0Answers: 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:



    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:

    } );

    [quote]dani said: it [/quote]
  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
    Please don't post duplicates! It just means I have less time to answer questions :-)
    http://datatables.net/forums/discussion/9003

    Allan
This discussion has been closed.