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 9004735
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:57:44+00:00 2026-06-16T00:57:44+00:00

I want to create a Dynamic Accordion control using Knockout JSON Mapping and Twitter

  • 0

I want to create a Dynamic Accordion control using Knockout JSON Mapping and Twitter bootstrap.

var ProductViewmodel;

function bindProductModel(Products) {
    var self = this;
    self.items = ko.mapping.fromJS([]);
    ProductViewmodel = ko.mapping.fromJS(Products.d, self.items);
    ko.applyBindings(ProductViewmodel);
}

var Data = {
    "d": [
        {
        "__type": "Warehouse.Tracntrace.Members_Only.DLL.StockMovement.AvailibleStock",
        "WarehouseID": 1,
        "ProductSKUID": 2,
        "ProductSKUName": "Decoder 1131",
        "WarehouseName": "SoftwareDevelopmentTest",
        "Status": "Staging",
        "QtyUnassigned": 5},
    {
        "__type": "Warehouse.Tracntrace.Members_Only.DLL.StockMovement.AvailibleStock",
        "WarehouseID": 1,
        "ProductSKUID": 3,
        "ProductSKUName": "Decoder 1132",
        "WarehouseName": "SoftwareDevelopmentTest",
        "Status": "Staging",
        "QtyUnassigned": 15}
    ]
};

    function BuildLinkFromJSON() {
        bindProductModel(Data);
        var link;
        link = '<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion" data-bind="text: d.ProductSKUName" href="#collapse"></a>';
        return link;
    }


function BuildAccordian(Pane) {
        var link = BuildLinkFromJSON();
        var eventsContainer = document.getElementById('accordion');
        var events = eventsContainer.innerHTML;
        events = events + '<div class="accordion-group"><div class="accordion-heading">'+link+'</div><div id="collapseOne" class="accordion-body collapse in"><div class="accordion-inner">My Content Here</div></div>';
        eventsContainer.innerHTML = events;
    }

    $(document).ready(function () {
        BuildAccordian();
    });

HTML:

<div class="accordion" id="accordion">
</div>

I basically need for each product in my JSON data the header should display the ProductSKUName and The QtyUnnasigned in the header, if this is even possible. I have created this Fiddle with the posted JSON data and the accordion HTML Function called Build Accordion.

  • 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-16T00:57:45+00:00Added an answer on June 16, 2026 at 12:57 am

    How about this? http://jsfiddle.net/billaraw/xZHbh/4/

    I basically added the loop so it can take each item:

    <div class="accordion" id="accordion2">
    
    <!-- ko foreach: $data -->
    <h3>
        <span data-bind="text: ProductSKUName"></span> :
        <span data-bind="text: QtyUnassigned"></span>                
    </h3 >
    <div>
        MyContent
    </div>
    <!-- /ko -->
    
    </div >​
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i want create Dynamic Slideshow in Jquery i'm Write this code var ctx =
I need some help. I want to create a dynamic line chart using Google's
I have issue where i want to create Dynamic function which will do some
I have some problem with JQuery accordion. I want to create dynamic accordion (to
I want to create a list with flash cs3 using the accordion component (the
Hello i want to create dynamic drop-downs using javascript, but its not working.. My
I want to create a dynamic Accordion, My usecase is like, On every click
I want to create XML with dynamic Element and attribute according to Database record
I want to create dynamic tabPages in TabControl. In each tabPage I create dataGridView
I want to create dynamic number of thread which is depends on the database

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.