我沒有看到文檔中的任何東西,但我試圖轉換HTML表格到jQuery網格呈現的代碼,但一個缺少的一塊是,許多列中有圖像或其他專業的HTML,我會喜歡在網格中顯示你可以有圖像或jQuery網格(jqgrid)單元格中顯示的任何自定義HTML?
3
A
回答
6
要在網格行顯示的圖像,this post有一個很好的總結:
返回HTML元素作爲網格列的數據。不要使用「或」爲SRC,這將無法正常工作的領域應該是這樣的:
<img src=../images/my_image.jpg>
1
這可能不是您之後的答案,但DataTables將從HTML表格構建網格。它具有用於服務器端分頁的客戶端分頁,排序,過濾,客戶端編輯和Ajax回調函數。
用表格作爲「源」,你可以在列中找到你想要的東西。
0
如果您想將圖像添加到jqGrid的的細胞,你必須使用一個黑客,如果你的數據類型是「客戶」,將工作以及
- 在一個變量設置圖像
- VAR crossImg =「設置你的圖像的HTML SRC」;
- 設置colmodel像這樣
- {名稱: 'delImage',索引: 'delImage',對齊: '中心',寬度:40,編輯:假的,格式化: '整數',formatoptions:{默認值:crossImg}}
0
$("#yourTableID").jqGrid({
url: '<%= ResolveUrl("ModelClass/ModelFunction")%>'
, datatype: "json"
, mtype: "POST"
, postData: { 'idofyourcolumn': $('#idofyourcolumn').val(),
'page': $('.pagedisplay').val(), 'rows': $('#rowCount').val()
}
, colNames: ['YOURHEADER', 'ACTION']
, colModel: [{ name: 'column1', index: 'column1name' },
{ name: 'action', index: 'action', width: 10, sortable: false, align: 'center'}]
, autoheight: true
, autowidth: true
, rowNum: 15
, rowList: [15, 20, 30, 50]
, pager: '#pager'
, sortname: 'column1'
, viewrecords: true
, sortorder: "desc"
, caption: "Sample Code"
, afterInsertRow: function (rowid, aData) {
jQuery('#yourTableID').setCell(rowid, 'action', '<img src="pathofyourimage/image.jpg" />');
}
, loadComplete: function() {
$('#ResultCount').text($("#yourTableID").getGridParam("records"));
}
})
.navGrid('#pager1'
, { search: true, refresh: false, view: false, del: false, add: false, edit: false }
, {} // default settings for edit
, {} // default settings for add
, {} // delete
, { closeOnEscape: true
, multipleSearch: true
, closeAfterSearch: true
} // search options
, {}
);
關鍵是在afterInsertRow:它包含你的列圖像和數據
相關問題
- 1. 自定義表格單元格以顯示圖像
- 2. 如何在自定義單元格中顯示自定義大小的圖像
- 3. 自定義表格單元格顯示
- 4. 在替代單元格中顯示圖像的自定義uitableviewcell
- 5. JqGrid和自定義單元格。自動完成和單元格中的網格。可能嗎。怎麼樣?
- 6. jqgrid樹狀網格顯示用戶自定義圖標
- 7. jqGrid與自定義單元格顏色
- 8. 在自定義單元格圖像上顯示TextLabel文本
- 9. 如何顯示自定義單元格中的圖像到詳細視圖
- 10. 表視圖沒有顯示我的自定義單元格
- 11. 自定義單元格不顯示
- 12. 自定義單元格不顯示PFImageView?
- 13. PFQueryTableViewController不顯示自定義單元格
- 14. Swift - 自定義視圖以顯示空表格單元
- 15. iOS 7自定義單元格不顯示在表格視圖
- 16. 自定義表格視圖單元格顯示空白
- 17. 隱藏自定義單元格圖像
- 18. 在jqgrid自定義格式化單元格上應用jquery工具提示
- 19. 你可以爲UITableView單元格插入自定義動畫嗎?
- 20. 你可以在detailTextLabel單元格中顯示一個小圖像嗎?
- 21. IOS自定義單元格,當單元格重用時顯示錯誤文本的IOS自定義單元格
- 22. 自定義單元格中的UIImageView中沒有圖像
- 23. WPF:以自定義格式顯示數據網格集合(帶圖像)
- 24. UITableView自定義單元格僅顯示所有單元格的一行文本
- 25. JTable單元格中的圖像顯示
- 26. jqGrid - 插入自定義HTML到單元格
- 27. 試圖顯示自定義模塊在管理網格圖像
- 28. 如何使用自定義靜態UITableViewCells在單元格中顯示圖像?
- 29. Ipython自定義提示以顯示單元格運行時間
- 30. 自定義表格單元格不顯示任何內容 - 斯威夫特2
+1的正確答案,但您與專家交換的鏈接對我無效。希望我會嘗試一個自定義格式化程序將我的圖像名稱包裝在IMG標記中,並且可以工作。 – 2010-03-17 11:47:16
如果您用\ – 2011-02-10 23:11:28
轉義它們,您可以添加's'您在代碼中確認了這一點? – 2011-02-11 02:25:51