add ztree to drag and sort notebooks

This commit is contained in:
iiuazz
2014-09-10 22:44:43 +08:00
parent bfcf8ec547
commit 2bed5b31fa
23 changed files with 465 additions and 17 deletions

View File

@ -21,7 +21,7 @@ type Notebook struct {
}
// 仅仅是为了返回前台
type SubNotebooks []Notebooks
type SubNotebooks []*Notebooks // 存地址, 为了生成tree
type Notebooks struct {
Notebook
Subs SubNotebooks // 子notebook 在数据库中是没有的
@ -32,7 +32,7 @@ func (this SubNotebooks) Len() int {
return len(this)
}
func (this SubNotebooks) Less(i, j int) bool {
return this[i].Seq < this[j].Seq
return (*this[i]).Seq < (*this[j]).Seq
}
func (this SubNotebooks) Swap(i, j int) {
this[i], this[j] = this[j], this[i]