On Apr 25, 9:19 pm, Mike <[email protected]> wrote:
> I currently have no dragSort save capability.
> I am hoping to use the dragEnd: function() to save the sort order to a
> field or array, but I am thinking I need to figure out a way to id the
> <li> elements. . .
I think, that's not needed. Had a look at example.html: rightClick:
view sourceCode. There is a script near the end of the file. This is
the callback function assigned to dragEnd for id list1 ..
function saveOrder() {
var serialStr = "";
$("#list1 li").each(function(i, elm) {
serialStr += (i > 0 ? "|" : "") + $(elm).children().html(); });
// your save to tiddler here
// $("input[name=list1SortOrder]").val(serialStr);
};
You could define the serialStr according to your needs. eg:
serialStr += "*" + $(elm).children().html() + "\n";});
if you use firebug you can write console.log(serialStr); to see what
it does (didn't test it)
It should produce a TW unordered list, which can be directly written
to a tiddler.
*test 1
*test 2 .... this is what I intended :)
> Right now I have: html input > unordered list > script activating
> dragSort
> Debating on starting over and going with a macro: html input > array
> item > modified array item > dragSort function > output to tiddler
>
> Originally I was hoping to have the unordered list inlineEdit + delete
> and dragSort as a Plugin
> and then have the form as a transclusion so that they could be used
> together or separate
An idea:
tiddler [[List Container]]
*test 1
*test 2
*test 3
tiddler [[test macro]]
<<tiddler "List Container" "makeSortable">>
<<dragsort>>
or
<<dragSort makeSortable>>
or
<<tiddler dragSort with: makeSortable>> depending on how you did your
plugin.
tiddler dragSort / DragSortPlugin
...... some code ........
function saveOrder() {
var serialStr = "";
// vvvvv
$(".makeSortable li").each(function(i, elm) {
serialStr += (i > 0 ? "|" : "") + $(elm).children().html(); });
// your save to tiddler [[List Container]]
// console.log(serialStr);
};
=====
This way only the class='makeSortable' will be sortable.
> Since the prototype took me a little over a week (in my spare time) -
> I may be in over my head, but I am enjoying the attempt
>
> Mike
hope this helps.
have fun!
Mario
>
> On Apr 25, 10:25 am, FND <[email protected]> wrote:
>
>
>
>
>
>
>
>
>
> > > If I wanted to add functionality to lists: (unordered lists)
> > > I.E. edit, dragsort, delete
> > > I am thinking I should start with expanding config.macros.list.handler
>
> > The list macro is quite different from the list formatter:
> > http://tiddlywiki.org/wiki/List_(macro)
> > That is, the former generates a list of tiddlers while the latter
> > converts wiki markup ("* foo") to HTML ("<li>foo</li>").
>
> > If you want any list within a tiddler to be sortable, you might have to
> > hijack a function like displayTiddler, modifying any UL/OL/DL after they
> > have been generated. Or you could use event delegation, e.g. globally
> > tracking click events, detecting double-clicks on list elements which
> > then activates edit mode. (I assume you already know about jQuery UI's
> > sortable and draggable?)
> > Note that persisting (saving) changes might be a challenge in itself.
>
> > > Finally has anyone else ventured into this already?
>
> > I believe Simon (TiddlyDocs), Paul (TiddlySlidy), Mike (Trails) and Eric
> > have done some work in this area, but I don't recall a particular plugin
> > right now.
>
> > -- F.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "TiddlyWikiDev" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> > [email protected].
> > For more options, visit this group
> > athttp://groups.google.com/group/tiddlywikidev?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "TiddlyWikiDev" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group
> athttp://groups.google.com/group/tiddlywikidev?hl=en.
--
You received this message because you are subscribed to the Google Groups
"TiddlyWikiDev" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/tiddlywikidev?hl=en.