페이지가 매겨진 데이터를 표시하는 데 Flexigrid를 사용하고 있으며 매우 잘 작동합니다. 이제 모든 행 ("편집", "보기", "삭제")에 대한 링크를 추가해야하며 솔직히 진행 방법을 모릅니다. 상자에서 바로 사용할 수있는 것이 있습니까?Flexigrid - 링크가있는 열 추가
기본 아이디어는 3 개의 링크에 작은 아이콘이있는 추가 열을 갖고 상단에 도구 모음이없는 것입니다.
아이디어가 있으십니까?
페이지가 매겨진 데이터를 표시하는 데 Flexigrid를 사용하고 있으며 매우 잘 작동합니다. 이제 모든 행 ("편집", "보기", "삭제")에 대한 링크를 추가해야하며 솔직히 진행 방법을 모릅니다. 상자에서 바로 사용할 수있는 것이 있습니까?Flexigrid - 링크가있는 열 추가
기본 아이디어는 3 개의 링크에 작은 아이콘이있는 추가 열을 갖고 상단에 도구 모음이없는 것입니다.
아이디어가 있으십니까?
나는 그것이 트릭은 단순히 스크립트에 의해 반환 된 데이터에 직접 링크를 넣어하는 것입니다
: 파악 있어요. 예를 들어이 문제가되는 링크가 포함 된 첫 번째 열에있는 행을 생성합니다 :
List<Object> rows = new List<Object>();
foreach (var item in results) {
rows.Add(new {
id = item.ID,
cell = new string[] {
String.Format("<a href='/Account/View/{0}'>view</a> <a href='/Account/Edit/{0}'>edit</a>", item.ID),
item.Name,
item.Phone
}
}
var result = new { page = page, total = rowcount, rows = rows };
return Json(result);
나는 그리드의 데이터를 빌드 "발표자가"마크 업을 주입한다는 사실을 좋아하지 않았다. "onSuccess"이벤트에서 실행되는이 작은 확장을 추가했습니다. 기본 열 표현을 링크로 변환합니다. 레일
(function ($) {
$.fn.flexLinkColumn = function (colIndex, url) {
if (colIndex === undefined || url === undefined)
throw "flexLinkColumn requires colIndex and url";
if ($(this).closest('div.flexigrid').length === 0)
throw "flexiLinkColumn only operates on flexilink grids.";
$(this).find('tr').each(function (index, tr) {
var rowId = $(tr).attr('id');
var itemId = rowId.substring(3);
var itemUrl = url + (itemId ? "/" + itemId : "");
var div = $(tr).find('td').eq(colIndex).find('div');
var text = $(div).text();
$(div).html('<a href="' + itemUrl + '">' + text + '</a>');
});
}
})(jQuery);
:
같은 추가 아래
return_data[:rows] = @countries.collect{|l| { :id => l.id, :cell=>[
'%a :href=>'javascript:void(0);'#{l.client_cont_person}', // normal html link
l.completed_on,l.created_by,l.project_id,l.status
]}}