Ajax auto refresh field value

QuestionsAjax auto refresh field value
Miguel asked 7 years ago

Hi,

It is possible to autorefresh a field value every X seconds using Ajax?

Thanks

Miguel

5 Answers
Abu Ghufran answered 7 years ago

There is no built in option for that.

You can have custom JS code that calls you ajax with setTimeout and
to set in grid's field you can use this syntax:

var grid = $("#list1");
grid.jqGrid('setCell',10,'total','2000');

This will enter 2000 in row with ID(first col):10 and column 'total'

Miguel answered 7 years ago

Thanks mate 😉

Miguel answered 7 years ago

This is how i did the trick:

On Grid.Col["default"] = "<div id='state'></div>";

On same page add script:

<script>
setInterval(function () {
$('#state').load("estados.php");
}, 1000);
</script>

On estados.php

<?php
echo shell_exec('date');
?>

This sample put system time in a Cell

Abu Ghufran answered 7 years ago

Yes, but it's out of the scope of grid.
That's custom JS work to be done manually.

Grid api is available to integrate, like mentioned in last reply. e.g.
grid.jqGrid('setCell',10,'total','2000');

C3media answered 7 years ago

Hello,

It´s possible to use the above code but calling function in same grid?

Thanks!

Your Answer

9 + 12 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?