How to retrieve one data element from data array

How to retrieve one data element from data array

DataTablesUserDataTablesUser Posts: 19Questions: 0Answers: 0
edited February 2012 in DataTables 1.8
how can i retrieve one data element from the data array? it looks like its called aaData...i need to pull a certain piece of data from inside of the array, it's the 2nd one in there

Replies

  • allanallan Posts: 63,494Questions: 1Answers: 10,470 Site admin
    aaData[1] ?

    I think you might need to explain what you are looking for a little bit more :-)

    Allan
  • DataTablesUserDataTablesUser Posts: 19Questions: 0Answers: 0
    k but this is not as important as my previous post...which i thought i solved...

    whenever I click the drop down to go to a new option, I need the search input to reset...right now i have it set to val('') but the problem is that even thought it resets the value, it doesnt carry out the reset function until that text input field is clicked again...I need it to reset the form as soon as the option is changed

    [code]
    $('#State').change(function () {
    $('.dataTables_filter input').val('').keyup();
    [/code]

    ^^^^ thats what i have in there...and it works before I added another element to my script...I made it so the zip code (aka the searchable data) doesnt show up until the search field has 5 digits in there with this code:

    [code]
    if($('.dataTables_filter input').val().length == 5) {
    /* Update all other filter input elements for the new display */
    var n = oSettings.aanFeatures.f;

    for ( var i=0, iLen=n.length ; i
  • DataTablesUserDataTablesUser Posts: 19Questions: 0Answers: 0
    hmmm...i made that "if" statement end before the code that comes after "/* Now do the filter */ as opposed to how i had it where i closed that "if" statement after that section...and it seems to work now
  • DataTablesUserDataTablesUser Posts: 19Questions: 0Answers: 0
    but I still don't know how to retreive data from the aaData array... i tried aaData[1] and it said that aaData was undefined
  • DataTablesUserDataTablesUser Posts: 19Questions: 0Answers: 0
    I still cant get it to work...

    I need one element from the data array...I don't know how to retrieve it...I tried this:

    [code]
    var aData2 = oTable.fnGetData();
    alert(aData2[3]);
    [/code]

    It returns "undefined"...I need it to return the data from the table

    What should I do?
  • allanallan Posts: 63,494Questions: 1Answers: 10,470 Site admin
    I've just posted a reply in your other thread. Please don't cross post as it makes it very hard to follow what is going on! :-)

    Allan
  • DataTablesUserDataTablesUser Posts: 19Questions: 0Answers: 0
    my bad i'll be more organized next time thanks tho
  • DataTablesUserDataTablesUser Posts: 19Questions: 0Answers: 0
    all set now thanks
This discussion has been closed.