Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
  1. #1
    New to the CF scene
    Join Date
    Dec 2012
    Thanked 0 Times in 0 Posts

    misoproject/dataset - how do write the data to the browser screen?

    EDIT - I have updated the code so all the js files link to remote copies. Previously the miso.ds.deps.ie.0.4.1.js file was a locally referenced file. This should allow you to run the code.


    I have managed to import information from a google spreadsheet into my page using the misoproject/dataset scripts.
    The dataset is named as the var = ds This is the whole spreadsheet.
    I have then created a subset of just one row of ds and this is named var = subset

    I can see this subset in the Firefox Console.
    Next I want to place this subset into a html table viewable in the browser.

    How do I make that next step? I have been trying document.write and other methods but I cannot get it to work.

    Eventually I want to create a mobile friendly web site that has many tables on it, each one populated by different data subsets, each one of those derived from the original larger dataset ds.

    So if you know of a way to create an html table and populate it with subset data, I can then repeat that method for each table I need to create. This might not be the most efficient way but this is only for a site I want to create for a few friends to use. It's to track our sports results predicting contest that I have until now just run off a a spreadsheet.

    Thanks. My code is below...

    <!DOCTYPE html>
            <meta charset="utf-8">
            <link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" />
            <script src="http://cloud.github.com/downloads/misoproject/dataset/miso.ds.deps.ie.0.4.1.js">
            <script src="http://code.jquery.com/jquery-1.8.2.min.js">
            <script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js">
        <title>testing data feeds</title>
            <script language="javascript" type="text/javascript">
                var ds = new Miso.Dataset({
                    importer: Miso.Dataset.Importers.GoogleSpreadsheet,
                    parser: Miso.Dataset.Parsers.GoogleSpreadsheet,
                    key: "0Ap-cOp8vqNpadG5GXzJsbmtRNlpObzhuRjIwanZfRWc",
                    worksheet: "1"
                    // create subset of just one row
                    var subset = ds.rows(function(row){
                        return (row.Qcode === 201205);
                    console.log("Subset length", subset.length);
                    console.log("Question number", subset.column("Qcode").data);
                    console.log("Matt ", subset.column("Matt").data);
                    console.log("Rob ", subset.column("Rob").data);
                    console.log("Paul ", subset.column("Paul").data);
                    console.log("Ross ", subset.column("Ross").data);
    Last edited by masmedia; 01-03-2013 at 05:07 PM.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts