1

I have a flagger table in which manually records inserted. I want to reload jqgrid after every 2 min and when new records added then wants to highlylight it. How to do this?

Siddiqui
  • 172
  • 1
  • 3
  • 16

1 Answers1

2

Your question consist from two parts: 1) reloading the grid every 2 min and 2) highlighting of the new added record.

For grid reloading you can easy implement with respect of setInterval JavaScript function. Here you can find an code example. If you use editing you should not refresh the grid during a row is in editing. Simple setting global boolean variable at the beginning of editing and clearing at the end of editing can help to solve the problem. Inside of function used in setInterval you can test the global variable and skip the grid reloading if the grid is in editing.

To highlight the row you can use jQuery UI effect with "highlight" parameter. See here.

Community
  • 1
  • 1
Oleg
  • 220,925
  • 34
  • 403
  • 798
  • 1) reloading the grid every 2 min is achived. thankx for it. 2)In second task. I checked the record count and save it in TempData["recordCount"], when new record added then i checked it with TempData record variable, and if TempData["recordCount"] is < to recordCount from db means that new data has been added in the table. Now, how can i change the rows of newly added record in jqgrid. I found the code of highlight but not understanding where i have to place it and how? – Siddiqui Aug 24 '11 at 10:07
  • @farhan: If I understand you correct now you mean that you want not just highlight "new records added" (added on the client side), but the rows **added on the server side**. In the case I would suggest you to use `userdata` part of the server response. It'is just *any additional data* which will be send from the server to jqGrid. Inside of `loadComplete` you can read the information and highlight or select (in case of `multiselect:true`) the some rows. – Oleg Aug 24 '11 at 10:56
  • @farhan: See [here](http://stackoverflow.com/questions/3848815/how-to-read-userdata-in-jqgrid/3849513#3849513), [here](http://stackoverflow.com/questions/3564898/jqgrid-programatically-select-grid-row/3571392#3571392) and [here](http://stackoverflow.com/questions/3128837/json-and-jqgrid-what-is-userdata/3128934#3128934) for additional information. – Oleg Aug 24 '11 at 10:57