List and Nested lists.md

#List and Nested lists

##Three representation of the data:
[1] Data to be stored at the backend
[2] Data the user will be typing
[3] Data that will be displayed to the user

If all three can be one unified representation, the better.

##Editing behaviour
Editing behaviour::
	Make each list as an entity::
		Select all should select only current line
		Shift arrow should not take the selection to next line
	Making a group of items as sublist of their current sibling
	Make the item as clickable, which would take us to details page
	Add check box for each list item
	Add draggable icon for each list item
	Add delete icon for each list item

##Problem statement
Create list and nested lists with options for each item::
	Add new items
	Know the element in focus
	Modify scope mappings
	Move scope objects
	Checked and numbered items
	Add nested items
	Move items up and down 		[LATER]
	Move items left and right	[LATER]
	&::Additional info

##Solution
###Using linear list always
To implement nested list as well, we implement nested list. Containment of list within list item helps reduce, on insertion updates, compared to linear list implementation.
Only the following siblings are to be updated. Even decendents are not touched.

###On inserting new row
Following factors to consider while adding new row::
	Update bindings of the following sibling dom nodes
	Update scope array for item index
For nested list
	Build index tree
	Update index tree on new row insertion::
		Find the list of nodes to be updated


#Possible options
##Basic list items
Add new items
Move items up and down
Know the element in focus
Modify scope mappings
Move scope objects
Checked and numbered items

###Solution:
Use plain text editor
On enter create a new line
Each line will have a check mark and draggable marker
List type can be changed via character within ::


##Nested list items
&::Basic list items
Add nested items
Move items left and right

###Solution:
For line ending with :?: create a nested list


##Simple list with attributes
&::Basic list items

###Solution 1:
Use plain text editor::
	For each line show up another subpage where one can add additional info

###Solution 2 *chosen*:
Each list item as a individual entity::
	For each line show up another subpage where one can add additional info
Increases the overhead of scope bindings and their updation.
Since each element that is associated with line based solution would have to be maintained as a seperated entity linked with the editor line items, maintaining each item as part of entity makes more sense.

##Nested list with attributes
&::Nested list items

###Solution
Same as above

##Additional info
Additional info::
	Due Date
	Reminder
	Time logging
	Log creation
	Attachments::
		Photo
		Document