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

  • Home
  • SEARCH
  • 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 404927
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T17:21:11+00:00 2026-05-12T17:21:11+00:00

I’m usually a C# developer, but writing a mostly-client side application using jQuery. It

  • 0

I’m usually a C# developer, but writing a mostly-client side application using jQuery.

It is reasonably straight forward: I have a list of “groups” which have some parameters (like a group name) and a list of “users” who also have some parameters.

At the moment I try to manage that using a <li> with a specific id, so there is a lot of string-matching involved to turn <li id="group-2">Name - ExtraInfo</li> back into something I can work with.

I feel that this approach is stupid because a) I use the UI as back-end for state and b) I rely on string parsing rather than working with real objects.

In C# I would just create a DTO (essentially a List<Group>), but I have not enough experience in JavaScript/jQuery to do that there.

Can someone give me some quick tips how to create a custom object and manage a list of these?

  • 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-05-12T17:21:11+00:00Added an answer on May 12, 2026 at 5:21 pm

    Expanding on Ionut G. Stan’s answer, I suggest nested objects:

    var groups = {
      group1: {
        name: "Group 1",
        users: {
          uid1: { name: "User 1" },
          uid2: { name: "User 2" },
          uid3: { name: "User 3" }
        }
      },
      group2: {
        name: "Group 2",
        users: {
          uid1: { name: "User 1" },
          uid4: { name: "User 4" }
        }
      }
    };
    
    • Check:
      if ("group1" in groups && "uid1" in groups["group1"].users) /* ... */;
    • Fetch:
      var username = groups["group1"].users["uid1"].name
    • Remove:
      delete groups["group1"].users["uid1"];
    • Add:
      groups["group1"].users["uid4"] = { name: "User 4" };

    To avoid unnecessary duplication and insert paradoxons:

    // all relevant users, for look-up purposes
    var allUsers = {
      uid1: { name: "User 1" },
      uid2: { name: "User 2" },
      uid3: { name: "User 3" },
      uid4: { name: "User 4" }
    }
    
    // groups reference the ID only, details are in allUsers["uid1"] etc
    var groups = {
      group1: {
        name: "Group 1",
        users: {uid1: 1, uid2: 1, uid3: 1}
      },
      group2: {
        name: "Group 2",
        users: {uid1: 1, uid4: 1 }
      }
    };
    
    • Check:
      if ("group1" in groups && "uid1" in groups["group1"].users) /* ... */;
    • Fetch:
      var username = allUsers["uid1"].name
    • Remove:
      delete groups["group1"].users["uid1"];
    • Add:
      groups["group1"].users["uid4"] = 1;
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 495k
  • Answers 495k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The elif "uname=" is never run because the string "name="… May 16, 2026 at 11:13 am
  • Editorial Team
    Editorial Team added an answer http://okonet.ru/projects/tooltips/ - free, but no dynamic resizing/ajax.. good for something… May 16, 2026 at 11:13 am
  • Editorial Team
    Editorial Team added an answer Use each_cons: { "000000001" => "0.00", "000000002" => "66.68", "000000010"… May 16, 2026 at 11:13 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I have a French site that I want to parse, but am running into
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Seemingly simple, but I cannot find anything relevant on the web. What is the
this is what i have right now Drawing an RSS feed into the php,
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti

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.