Skip to content

Instantly share code, notes, and snippets.

@puiutucutu
Created October 19, 2015 19:19
Show Gist options
  • Select an option

  • Save puiutucutu/bb0b8f0a72fbef43916f to your computer and use it in GitHub Desktop.

Select an option

Save puiutucutu/bb0b8f0a72fbef43916f to your computer and use it in GitHub Desktop.
push array nested js
responseAsArray = []
// expand to have the correct amount or rows
for(var i = 0; i < 12; i++ ) {
responseAsArray.push([]);
}
// expand all rows to have the correct amount of cols
for (var i = 0; i < response.length; i++) {
responseAsArray[i].push(response[0].Name);
responseAsArray[i].push(response[0].EContentsID);
responseAsArray[i].push(response[0].InsertDate);
}
@puiutucutu
Copy link
Copy Markdown
Author

        responseAsArray = []

        // expand to have the correct amount or rows
        for(var i = 0; i < response.length; i++ ) {
            responseAsArray.push([]);
        }   

        debug(response)


        // expand all rows to have the correct amount of cols
        for (var i = 0; i < response.length; i++) {
            responseAsArray[i].push(response[i].Name)
            responseAsArray[i].push(response[i].EContentsID)
            responseAsArray[i].push(response[i].InsertDate)
        }

        debug(responseAsArray)

@puiutucutu
Copy link
Copy Markdown
Author

    // destroy data table if it has already been initialized
    if ($.fn.DataTable.fnIsDataTable(jQuery(table))) {
        table.DataTable().destroy()
    }

@puiutucutu
Copy link
Copy Markdown
Author

@puiutucutu
Copy link
Copy Markdown
Author

                            <!-- Data Table ::: Start -->
                            <table id="resultTable" class="table table-striped table-bordered table-hover table-condensed no-bottom-margin"></table>
                            <!-- Data Table ::: End -->

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment