Hi, I have this grid displaying some plain mysql table: id (int) , name varchar(10)
Users can add records to this table using my grid (php code server side).
they can add only one record or several.
I have problems refreshing the grid when multiple records are inserted. ( when only 1 record is inserted everything works fine)
My serverside php script ends with something like this:
<?php
$pdo->Query( ‘select * from myTable where id IN ( … , … , … , … )’ ); // supose the query is OK.
$Results = array();
while( $row = $pdo->getRow() ) {
$Results[‘data’][] = $row;
}
$Results[‘status’] = ‘ok’;
die( json_encode($Results) );
?>
And my client side (.js)
$.ajax({
url: ‘myScript.php’, data: {howManyRecords: $(‘#recs’).val(), name: $(‘#name’).val() }, method: ‘post’,
success: function( response ) {
var obj = $.parseJSON(response);
// let’s collect rows returned
var rows = new Array();
$.each( obj.data, function( k, v ) {
rows.push(v);
});
// refresh grid
$(‘#jqxGrid’).jqxGrid(‘addrow’, null, rows);
// close modal window
$(‘#jqxWindow’).jqxWindow(‘hide’);
}
})
My grid refreshes only one record. But if I reload the page ( F5 ), all records are shown.
What am I missing ???
thanks in adv