Guest User

Untitled

a guest
May 13th, 2012
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.71 KB | None | 0 0
  1. jqGrid: format cell value without changing actual (underlying) value?
  2. { name: 'Id', index: 'Id', editable: true, hidden: true,
  3. editoptions: { defaultValue: row_id,
  4. dataUrl: "DataService.asmx/GetList",
  5. buildSelect: function (data) {
  6. var s = '<select>';
  7. if (data && data.d) {
  8. //data is nested, so we need a few steps to get to the actual data
  9. var list = data.d;
  10. var opts = JSON.parse(list);
  11. var subList = opts.List;
  12. //loop through the data to build the options list
  13. for (var i = 0, l = subList.length; i < l; i++)
  14. { var ri = subList[i];
  15. s += '<option value=' + ri.Id + '>' + ri.Name + '</option>';
  16. }
  17. }
  18. else {
  19. s+= "<option value=0>No data to display</option>";
  20. }
  21. return s + "</select>";
  22. } ,
  23. dataEvents: [
  24. { type: 'change',
  25. fn: function (e) {
  26. $('input#Id').val(this.value);
  27. }
  28. }
  29. ]
  30.  
  31. },
  32. editrules: {edithidden: true},
  33. edittype: 'select'
Advertisement
Add Comment
Please, Sign In to add comment