Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8995979
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:41:31+00:00 2026-06-15T23:41:31+00:00

I have a table where each row contains some data ( data-id ) and

  • 0

I have a table where each row contains some data (data-id) and a <div class = "upload">Upload</div>. The uploader needs to be passed an object which contains uploader_obj.button set as the initiating <div>, any parameters such as data-id to be sent to the server, and a bunch of other stuff which I didn’t show.

The following script loops over the table, modifies the object to set button and params.id, and creates the uploader on each row.

While a separate upload button is created on each row, they each reference the same params.id which is set to the last row’s value (i.e. 222). I need each to be set to the value of their specific row.

One way to fix it is to have each uploader have it’s own upload_obj, but this seems like a waste of memory.

Instead, I tried to reference data-id within the uploader_obj. I can do so within onSubmit, however, haven’t figured out how to use this value to set param.id. I’ve tried to set it within param by doing something like params: {'id':$(this.button).parent().parent().data('id')} but this is my document, and not the uploader.

So… Without making a separate uploader_obj for each row, how could I make each row’s uploader sent its own param.id to the server? Thank you

PS. Sorry for the weak title. I really tried to think of a better one but couldn’t.

<table>
    <tr data-id="123"><td>Hello</td><td><div class="upload">Upload</div></td></tr>
    <tr data-id="321"><td>Hello</td><td><div class="upload">Upload</div></td></tr>
    <tr data-id="222"><td>Hello</td><td><div class="upload">Upload</div></td></tr>
</table>

var uploader_obj = {
  button:null,
  params: {'id':null},
  onSubmit: function(id, fileName) {
     var id=$(this.button).parent().parent().data('id')
     console.log(id);
  },
  otherStuff: whatever
};


$('#myTable div.upload').each(function(i,v){
    uploader_obj.button=this;
    uploader_obj.params.id=$(this).parent().parent().data('id');
    new qq.FileUploaderBasic(uploader_obj);
});
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T23:41:32+00:00Added an answer on June 15, 2026 at 11:41 pm

    You’re passing the same object in every iteration, just create the object from the values you have inside the loop instead:

    $('#myTable div.upload').each(function(i,ele){
        new qq.FileUploaderBasic({
            button: ele,
            params: {
                id: $(ele).closest('tr').data('id')
            },
            onSubmit: function(id, fileName) {
                var id=$(this).closest('tr').data('id')
            },
            otherStuff: whatever
        });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Ok, I have a table which contains multiple rows. Each row contains some data
I have a table which is being dynamically populated, each row contains two textfields
I have a table in SQL Server 2005 which contains some changelog data for
I have a table with all U.S. zip codes. each row contains the city
I have a table of users where each row contains their names, e-mail address,
I have a table that contains some user data: user_id | guest_id | time_seen
I have an HTML table where the first cell of each row contains text
I have an object which I'm filling with objects containing 2 table rows each.
I have a grouped table view that contains 3 sections and each row per
I have two tables, one table has some information in each row along with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.