Yui 데이터 가능에 가장 가까운 jQuery 근사치는 무엇입니까?
-
19-09-2019 - |
문제
저의 두 가지 우선 순위는 점진적 향상과 인라인 편집입니다. 나는 진보적 인 향상을 발견했다 (데이터 가능) 및 인라인 편집 (JQGRID), 그러나 둘 다 아닙니다. jQuery UI 테마에 대한 지원은 좋지만 우선 순위가 낮습니다.
업데이트 : 다음은 솔루션이 닮을 상상하는 예입니다.
<table summary="A table full of example tabular data">
<caption>My Table to Progressively Enhance</caption>
<thead>
<tr>
<th id="colA">Column A</th>
<th id="colB">Column B</th>
</tr>
</thead>
<tbody>
<tr>
<td headers="colA">foo</td>
<td headers="colB">bar</td>
</tr>
<tr>
<td headers="colA">argle</td>
<td headers="colB">bargle</td>
</tr>
</tbody>
</table>
… insert jquery datatable stuff here …
<script type="text/javascript">
progressivelyEnhanceMyTable();
</script>
해결책 2
JQGRID의 최신 릴리스를 통해 이제 우리는 tableToGrid
, 마크 업 문제를 잘 해결하는 것은 매우 훌륭하게 해결됩니다.
다른 팁
제 생각에는 JQGRID 꽤 잘 맞을 것입니다.
업데이트:
이와 같은 코드를 사용하여 테이블을 JavaScript 객체로 변환 할 수 있습니다.
var $table = $('table'); // select your table
var data = []; // instantiate the data array
$('tr', $table).each(function(i, item){ // loop through the table rows
obj = {} // create the object to append to the data array
obj.name = $('td:eq(0)',$(this)).text().trim();
obj.desc = $('td:eq(1)',$(this)).text().trim();
data += obj; // add the object to the array
});
그런 다음 배열 데이터 예제
for(var i=0;i<=data.length;i++) $("#datagrid").addRowData(i+1,data[i]);
DataTables에 호출되는 플러그인이 있습니다 jQuery-datatables-편집 가능 인라인 편집을 추가합니다.
제휴하지 않습니다 StackOverflow