Need help implementing select2 with editor

Need help implementing select2 with editor

cdelstadcdelstad Posts: 11Questions: 2Answers: 0

I really need some help. I am trying to implement select2, but I cannot find anywhere to actually download a select2 plugin, only the select 1.2.0 plugin. I am assuming that's why type: 'select2' is not working for me. type:'select' works OK.
I am currently in my trial period for the editor plugin.
I cannot even find a full example of implementing the select2 version with the datatables.net. I need to see how I add select2 parameters in to the editor config.

What asset include order do they need to be in as well? Here is the order I am using now:
<link rel="stylesheet" href="resources/app/styles/libs/datatables/dataTables.bootstrap.css" />
<link rel="stylesheet" href="resources/app/styles/libs/datatables/buttons.dataTables.css" />
<link rel="stylesheet" href="resources/app/styles//libs/select2/css/select2.min.css" />
<link rel="stylesheet" href="resources/app/styles/libs/datatables/Editor-1.5.6/css/editor.dataTables.css" />
<link rel="stylesheet" href="resources/app/styles/libs/datatables/Editor-1.5.6/css/editor.bootstrap.css" />
<link rel="stylesheet" href="resources/app/styles/libs/datatables/Select-1.2.0/css/select.dataTables.css" />

    <script src="resources/app/scripts/libs/datatables/datatables.js"></script>
    <script src="resources/app/scripts/libs/datatables/datatables.bootstrap.js"></script>
    <script src="resources/app/scripts/libs/select2/js/select2.full.min.js"></script>
    <script src="resources/app/scripts/libs/datatables/Editor-1.5.6/js/dataTables.editor.js"></script>
    <script src="resources/app/scripts/libs/datatables/Editor-1.5.6/js/editor.bootstrap.js"></script>
    <script src="resources/app//scripts/libs/datatables/Select-1.2.0/js/dataTables.select.js"></script>

Here is my current example.
var editor = new $.fn.dataTable.Editor( {
table: "#manifestSummaryDT",
idSrc: 'manifestId',
fields: [ {
label: "Manifest Creation:",
name: "statusNm",
type: "select2",
opts: {
ajax: {
url: "https://api.github.com/search/repositories",
dataType: 'json',
delay: 250,
data: function (params) {
return {
q: params.term, // search term
page: params.page
};
},
processResults: function (data, params) {
// parse the results into the format expected by Select2
// since we are using custom formatting functions we do not need to
// alter the remote JSON data, except to indicate that infinite
// scrolling can be used
params.page = params.page || 1;

                        return {
                          results: data.items,
                          pagination: {
                            more: (params.page * 30) < data.total_count
                          }
                        };
                      },
                      cache: true
                    }
              }

          }
      ]
  } );

Am I even close?
Any help would be greatly appreciated.
Thanks in advance,
-Chad

Answers

  • cdelstadcdelstad Posts: 11Questions: 2Answers: 0
    edited June 2016

    The issue is that the select2 plugin is not available without purchasing the editor. I was able to get things working for the most part, however, I am still having issues with integrating the select/select2 dropdowns in to the datatable which I put the information in this discussion: https://datatables.net/forums/discussion/35801
    Please respond there if you can help.
    I cannot close this discussion.
    Thanks again,
    -Chad

This discussion has been closed.