asked on February 6, 2018
•
Show version history
@Rui Deng helped me with the below code. I am having a hard time retrieving the tab text to include with each attchment. I could get it at the .on() event, but can't get it further down for the .each().
In the code below, for each attachment on various tabs, they are consolidated onto one tab. I need to group them by the tab that they come from. There is a console.log in the code in an attemtp to traverse the DOM and get what I need, but it isn't working. Help please!
//custom attachments list var filesList = []; $('.fileuploader').on('updatevalidation', function(){ filesList = []; $('.myUpload').each(function(){ $(this).find('.file').each(function(){ console.log($(this).closest('.cf-formwrap').prev().find('ul.cf-pagination-tabs li.active a').text()) var file = {} //file.tab = file.title = $(this).find('td:eq(0) a').attr('title'); file.href = $(this).find('td:eq(0) a').attr('href'); file.size = $(this).find('td:eq(1) div').text(); file.aid = $(this).find('.delCell div').attr('aid'); filesList.push(file); }); }); var html = '<table class="files"><colgroup><col width="80%"><col width="15%"><col width="5%"></colgroup><tbody>'; _.each(filesList, function(file){ html += '<tr class="file"><td><a target="_blank" download="" title="' + file.title + '" class="ellipsis" href="'+file.href+'">'+file.title+'</a></td>/*<td><div>'+file.tab+'</div></td>*/<td><div>'+file.size+'</div></td><td class="delCell"><div onclick="DeleteFile('+file.aid+')" class="selectable lfi-times" title="Delete">×</div></td></tr>'; }); html += '</tbody></table>'; $('.customHTML').html(html); });
thanks!
0
0