I am not able to understand the following code? can you please explain in detail?

I am not able to understand the following code? can you please explain in detail?

praphullapraphulla Posts: 13Questions: 5Answers: 0
edited June 2017 in Free community support

After retriving the response we write :

   var api = this.api();
  api.rows( {page:'current'} ).data();
&
api.rows( {page:'current'} ).nodes();

Actually I have retrived the JSONObject like:

{
    "rows": [{
        "ID": "0530201723001738",
        "NAME": "ABC"
        "CLG": "IIT",
        
    }, {
        
        "ID": "5640201723001738",
        "NAME": "JHON"
        "CLG": "IIM",
    }
}

How the api works and and how it diffrentiate between:

api.rows( {page:'current'} ).data();
&
api.rows( {page:'current'} ).nodes();

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,438Questions: 1Answers: 10,052 Site admin
    edited June 2017

    The rows() method will select the rows based on the selector you give it (in this case it is selected the rows based on the current page). That stores information in the API instance which allows it to then chain on additional methods - rows().data() for example. There are other methods such as rows().every() and rows().indexes() as well which can also be used.

    Allan

  • praphullapraphulla Posts: 13Questions: 5Answers: 0

    Hi I have different JSON objects inside the rows and I have used the selector {page:'current'} how this selector works and when it comes in picture and you wrote that
    (in this case it is selected the rows based on the current page) what is current page term im not getting.

  • allanallan Posts: 61,438Questions: 1Answers: 10,052 Site admin
    Answer ✓

    This is the code for how it works.

    If it isn't working for you, please link to a test case showing the issue so it can be debugged.

    Allan

  • praphullapraphulla Posts: 13Questions: 5Answers: 0
    edited June 2017

    I didn't understood whole code but little bit I understood.Thanks

This discussion has been closed.