Some Dojo components require additional metadata along with the dojo.data payload. As an example, dojox.grid.Grid can pull data dynamically from a dojox.data.QueryReadStore. For pagination to work correctly, each return payload should contain a numRows key with the total number of rows that could be returned by the query. With this data, the grid knows when to continue making small requests to the server for subsets of data and when to stop making more requests (i.e., it has reached the last page of data). This technique is useful for serving large sets of data in your grids without loading the entire set at once.
Zend_Dojo_Data allows assigning metadata properties as
to the object. The following illustrates usage:
<?php
// Set the "numRows" to 100
$data->setMetadata('numRows', 100);
// Set several items at once:
$data->setMetadata(array(
'numRows' => 100,
'sort' => 'name',
));
// Inspect a single metadata value:
$numRows = $data->getMetadata('numRows');
// Inspect all metadata:
$metadata = $data->getMetadata();
// Remove a metadata item:
$data->clearMetadata('numRows');
// Remove all metadata:
$data->clearMetadata();




