2017-01-10 48 views

回答

0

我有一個解決方案,我已經在我的實踐中應用。代碼足夠大,所以我會給你一段代碼。看一看。有templete功能 1)例如,用於顯示所有用戶:

function userTemplate(user) { 
return '<div class="content-column-data">'+ 
'<img class="customer-image" src="../../../assets/images/customer/'+ user.img +'">'+ 
'<div class="customer-name">'+ user.name +'</div>'+ 
'</div>'); 
} 

2),用於顯示所有表格單元:

function mainBlockAdd(adress, itemInfo){ 
    $(adress).append(
     '<div class="content-column-data">'+ 
     itemInfo + 
     '</div>' 
    ); 
} 

它們,我們應該傳輸所有接收到的數據:

function loadTable(responseNew){ 
    $('.noRes').hide(); 
    left_people_block_show(responseNew); 
    store_show(responseNew); 
    customer_details_show(responseNew); 
    reservations_show(responseNew); 
    activity_show(responseNew); 
    $('#static-columns').show(); 
    $('#sortable-overlay').show(); 
    showTopBtn(); 
    hideBlocks(); 
} 

如果我的代碼似乎對您有幫助,請使用以下文章的完整版本: http://computoolsglobal.com/blog/how-to-create-a-datatable-manually-without-the-use-of-libraries/

+0

謝謝!它幫助了我。 –

相關問題