variable html is this php file:

<?php

$x=$_GET['chapter-number'];

echo <<<EOS
<li id="chapter-$x-container"><h4>Chapter $x Remove Chapter</h4>
<ol>
<li>
<label for="chap-$x-title">Chapter Title:</label>
<input type="text" name="chap-$x-title" id="chap-title" />
</li>
<li>
<label for="chap-$x-web-descrip">Chapter Web Description:</label>
<textarea name="chap-$x-web-description" id="chap-$x-web-description"
rows="5" cols="28"></textarea>
</li>
<li>
<label for="chap-$x-full-description">Chapter Full Description:</label>
<textarea name="chap-$x-full-description" id="chap-$x-full-description"
rows="5" cols="28"></textarea>
</li>
<li>
<label for="chap-$x-thumb-url">Thumbnail URL: <br/> (Anamorphic ratio 2.35:1
) / Thumbnail 142px x 60px</label>
<textarea class="for-url" name="chap-$x-thumb-url"
title="chap-$x-thumb-url"></textarea>
</li>
<li>
<label for="chap-$x-start">Chapter Start Time: <br/ > H:M:S.SSS</label>
<input type="text" name="chap-$x-start" id="chap-$x-start" />
</li>
<li>
<label for="chap-$x-end">Chapter End Time: <br/> H:M:S.SSS</label>
<input type="text" name="chap-$x-end" id="chap-$x-end" />
</li>
</ol>
</li>
EOS;

?>
 




MorningZ wrote:
> 
> 
> its tough to diagnose without knowing what your variable "html"
> returned by the $.ajax call is
> 
> but working up an example trying to simulate it, this works as
> expected....  items stay in order of adding plus the <ol> items adjust
> their indexes automatically
> 
> http://paste.pocoo.org/show/86671/
> 
> 
> 
> 
> On Sep 30, 5:37 pm, claudes <[EMAIL PROTECTED]> wrote:
>> i have an interface that allows user to add chapters and remove any
>> chapter
>> from within the group. i'm having issues re-calculating the sort order.
>> currently if user adds four chapters (1,2,3,4), removes 2 and adds two
>> more
>> the order becomes (1, 3,4,2,3). i know i need to so something with index
>> calculation...but how to is what is confusing me. this is the code that
>> performs the add remove.
>>
>> $("#chapter-append").click(function() {
>>                         var chapterCount = new
>> Number($("#chapter-count").val());
>>                                 if (chapterCount <1) chapterCount=0;
>>                 chapterCount = chapterCount +1;
>>                  $("#chapter-count").val(chapterCount);
>>
>>                 var queryString =
>> "add-chapter.php?chapter-number="+chapterCount;
>>                 //alert(queryString);
>>          $.get(queryString, function(html) {
>>              // append the "ajax'd" data to the table body
>>              $("ol#add-chapter").append(html);
>>                                                 $("ol#add-chapter li
>> h4").bind('click', function() {
>>                                                                 var
>> newChapter = "#chapter-"+chapterCount+"-container";
>>                                                        
>> $(newChapter).remove();
>>                                                                        
>> chapterCount = chapterCount -1;
>>                                                                        
>> $("#chapter-count").val(chapterCount);
>>                                                                        
>> return false;
>>                                                 });
>>                                                 $('textarea').autogrow({
>> minHeight: 144, lineHeight: 16});      
>>                                                
>> $('textarea.for-url').autogrow({ minHeight: 24, lineHeight: 16});
>>                                 });
>>         return false;
>>         });
>>
>> --
>> View this message in
>> context:http://www.nabble.com/add-remove-and-recalculate-index-tp19750882s272...
>> Sent from the jQuery General Discussion mailing list archive at
>> Nabble.com.
> 
> 

-- 
View this message in context: 
http://www.nabble.com/add-remove-and-recalculate-index-tp19750882s27240p19753117.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.

Reply via email to