Unable to add buttons to code (novice)

Unable to add buttons to code (novice)

rppriderppride Posts: 1Questions: 1Answers: 0
edited February 2019 in Free community support

Really trying to grasp all of this but I have some basic code that works and trying to add buttons for printing and exporting to pdf but unable to get to work with current code.

Functioning code:
https://jsfiddle.net/rp_prideone/fb1wxu0j/38/#&togetherjs=hjVx37VVRg

$(document).ready(function() {
  var results = [];
  var url = "https://spreadsheets.google.com/feeds/list/1kz1v501puvBXUu5mllp0VVhWxkpbiCIdhnUJrCL3AGg/od6/public/values?alt=json";

  var jqxhr = $.getJSON(url, function() {
      console.log("success");
    })
    .done(function(data) {
      console.log("second success");
      var entry = data.feed.entry;
      $(entry).each(function() {
        // Column names are name, age, etc.
        //results.push({"Id" : this.gsx$id.$t , "Name" : this.gsx$name.$t, "Country" : this.gsx$country.$t, "Solutions" : this.gsx$solutions.$t});
        results.push([this.gsx$item.$t, this.gsx$description.$t, this.gsx$serial.$t, this.gsx$location.$t, this.gsx$asset.$t, this.gsx$qty.$t]);
      });
      var table = $('#example').DataTable({
        "pageLength": 25,
        data: results,
        columns: [{
            title: "Item"
          },
          {
            title: "Description"
          },
          {
            title: "Serial"
          },
          {
            title: "Location"
          },
          {
            title: "Asset"
          },
          {
            title: "Qty"
          }
        ]

      });


    })
    .fail(function() {
      console.log("error");
    })
    .always(function() {
      console.log("complete");
    });
});

Answers

  • colincolin Posts: 15,237Questions: 1Answers: 2,598

    Hi @rppride ,

    There's no mention of buttons in your code - not the JS/CSS files or the buttons declarations. It would be worth looking at the examples here - noting the files being included and the initialisation options being used.

    Cheers,

    Colin

This discussion has been closed.