Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example code doesn't work #17

Closed
maurice-schleussinger opened this issue Sep 21, 2015 · 1 comment
Closed

Example code doesn't work #17

maurice-schleussinger opened this issue Sep 21, 2015 · 1 comment

Comments

@maurice-schleussinger
Copy link

Uncaught TypeError: this.$textarea.select2 is not a function

This (slightly adjusted) example code is not working:
(This error was also mentioned at #6 )

<script src="https://code.jquery.com/jquery-1.8.3.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/3.5.2/select2.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/handsontable/0.16.0/handsontable.full.js"></script>
<script src="/static/Handsontable-select2-editor/select2-editor.js"></script>

<script type="text/javascript">

var mydata = [{ num: 1, num2: 2, num3: 3 }
             ,{ num: 1, num2: 2, num3: 3 }
             ,{ num: 1, num2: 2, num3: 3 }
             ,{ num: 1, num2: 2, num3: 3 }
             ,{ num: 1, num2: 2, num3: 3 }
             ,{ num: 1, num2: 2, num3: 3 }];

var optionsList = [{id: 1, text: 'first'}, {id: 2, text: 'second'},{id: 3, text: 'Third'}, {id: 4, text: 'Forth'},{id: 5, text: 'Fith'}];
var columnsList = [{
                    data: "num", // from datasource
                    editor: 'select2',
                    select2Options: { // these options are the select2 initialization options
                        data: optionsList,
                        dropdownAutoWidth: true,
                        allowClear: true,
                        width: 'resolve'
                    }
                },
                {
                    data: "num2", // from datasource
                    editor: 'select2',
                    select2Options: { // these options are the select2 initialization options
                        data: optionsList,
                        dropdownAutoWidth: true,
                        allowClear: true,
                        width: 'resolve'
                    }
                }
                ,
                {
                    data: "num3", // from datasource
                    editor: 'select2',
                    select2Options: { // these options are the select2 initialization options
                        data: optionsList,
                        dropdownAutoWidth: true,
                        allowClear: true,
                        width: 'resolve'
                    }
                }
                ];
$(document).ready(function () {

this.$container = $("#spreadsheet_area");
this.$container.handsontable({
    data: mydata,
    columns: columnsList
    });
});

</script>

(#spreadsheet_area is a div for Handsontable.)

@maurice-schleussinger
Copy link
Author

My bad, I used jQuery v2.1.4 instead of v1.8.3 because I tried this with flask and template inheritance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant