嘗試在具有主幹的表格內創建表格,但無法找到方法。任何人都可以通過一個例子來幫助我實現這個目標嗎?使用主幹JS創建子視圖(在另一個表內的表格)
我的收藏:
this.collection = new Backbone.Collection([
{ first: 'John', last: 'Doe', desig: 'E1', location: 'C' },
{ first: 'Mary', last: 'Jane', desig: 'E3', location: 'C' },
{ first: 'Billy', last: 'Bob', desig: 'E2', location: 'C' },
{ first: 'Dexter', last: 'Morgan', desig: 'E1', location: 'P' },
{ first: 'Walter', last: 'White', desig: 'E2', location: 'P' },
{ first: 'Billy', last: 'Bobby', desig: 'E1', location: 'B' }
]);
普通視圖:使用表格視圖實現了這個。參照那麼代碼here
first last desig location
----------------------------------
Billy Bobby E1 B
Walter White E2 P
Dexter Morgan E1 P
Billy Bob E2 C
Marry Jane E3 C
John Doe E1 C
按位置要羣想呈現像下面
location first last desig
----------------------------------
C Billy Bob E2
Marry Jane E3
John Doe E1
P Walter White E2
Dexter Morgan E1
B Billy Bobby E1
使用下劃線我們可以做分組但在那之後,我努力呈現的對象作爲新的視圖以上視圖
_.groupby(this.collection, "location");
給我一個對象,它具有所需的結果。
你只需要呈現一個集合視圖的collection視圖。第一個集合的輸入將是'_.groupby'的結果,子集合視圖的輸入將是一個特定的組,並且它的項目視圖的輸入將是特定的記錄。 –
我試圖創建一個更多的視圖,同時創建第一個表的行視圖,我試圖創建子視圖,但沒有爲我工作。你能指出一個例子,以便我可以學習和實現嗎?https://jsfiddle.net/WebDev81/ddbf9ckv/2/ – user3625533
在小提琴中,你只有2個視圖。請分享您的嘗試與3意見。所有你需要的是創建表體的另一個視圖 –