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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T14:07:21+00:00 2026-06-14T14:07:21+00:00

I want to templatize the creation of a YUI3 datatable using KnockoutJS data bindings.

  • 0

I want to templatize the creation of a YUI3 datatable using KnockoutJS data bindings.
Let’s say I have following JSON string –

{
“@lang”: “en-US”,

"cartItem": {
    "@lang": "en-US",
    "cartId": "14",
    "items": [
        {
            "@lang": "en-US",
            "id": "5",
            "name": "global/network/main",
            "propertyURL": "mail.yahoo.com",
            "rootPropertyName": "All Other",
            "spaceId": "2023407535"
        },
        {
            "@lang": "en-US",
            "id": "5",
            "name": "global/network/main",
            "propertyURL": "mail.yahoo.com",
            "rootPropertyName": "All Other",
            "spaceId": "2023407535"
        }
    ]
},
"status": {
    "@lang": "en-US",
    "message": "",
    "status": "success"
}

}

And I’m using the following code to create the YUI datatable consuming the above JSON –

YUI().use( “datatable”, “datatable-datasource”, “datasource-local”, “datasource-jsonschema”, function(Y) {

    var jsonString = Y.one("#jsondata").getHTML();

    var dtsource = new Y.DataSource.Local({source:jsonString});
    dtsource.plug(Y.Plugin.DataSourceJSONSchema, {
        4schema: {
            resultListLocator: "cartItem.items",
            resultFields: [
            // Re-map the "id" member to "rid" ...    
                { key:"rid", locator:"id"},
                "name", "propertyURL", "rootPropertyName"
            ]
        }
    });

    var colums = ["rid", "name", "propertyURL", "rootPropertyName"];

    var dtable = new Y.DataTable({  
        columns: colums,
        summary:"Shopping cart items",
        caption:"Table with JSON data from api"});

    dtable.plug( Y.Plugin.DataTableDataSource,{
        datasource:dtsource
    });

    dtable.render("#jsonapi-datatable");
    dtable.datasource.load({request:"&id=14"});        
});

How can create a KnockoutJS template for the above code?

Fiddle at – http://jsfiddle.net/pPY7K/6/

  • 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-14T14:07:22+00:00Added an answer on June 14, 2026 at 2:07 pm

    Use KnockoutJS custom bindings and then create a template using that binding.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a windows mobile application in Visual Studio. I want to templatize
Let's imagine we have several type of elements, and we want to create a
I have the following template in django, i want to get the totals of
I have an XML with multiple nodes with similar data in each. I want
I want to create a template class (let's call it Foo ) that only
I want to have a template class that looks something like what I have
I'm using the JDBC template and want to read from a database using prepared
We have been using TFS 2010 for about 6 months and we have decided
I have a ASP.NET MVC4 project with HTML5 semantic markup enabled. When using @Html.EditorFor(m
I want to be able to display set of data differently according to url

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.