Bootstrap-table: Doesnt load the table: Uncaught TypeError: Cannot convert object to primitive value

Created on 11 Aug 2019  ·  16Comments  ·  Source: wenzhixin/bootstrap-table

Hi all,

I haven't been able to load any kind of bootstrap-table code. Not even the examples on the website. I keep getting the same javascript error:

bootstrap-table.min.js:10 Uncaught TypeError: Cannot convert object to primitive value
    at Object.setFieldIndex (bootstrap-table.min.js:10)
    at e.value (bootstrap-table.min.js:10)
    at e.value (bootstrap-table.min.js:10)
    at new e (bootstrap-table.min.js:10)
    at HTMLTableElement.<anonymous> (bootstrap-table.min.js:10)
    at Function.each (jquery.min.js:2)
    at w.fn.init.each (jquery.min.js:2)
    at w.fn.init.t.fn.bootstrapTable (bootstrap-table.min.js:10)

My dependencies are correct; the jquery and the bootstrap library load well in the browser from the CDNs(otherwise it wouldnt recognize them here).
Im using version 1.15
I am using W10, and Chrome 76.0.3809.100 .

Please, any help would be appreciated

build confirmed

Most helpful comment

I have the same problem and I think the right solution for it will be to take [email protected] like it's stated in bootstrap 4.4 documentation.

All 16 comments

I just changed the CDN for this one(using version 1.10):

<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.10.1/bootstrap-table.min.js"></script>

and the code worked flawlessly. I think there is a bug in the 1.15 release maybe? Not even the example code worked with the 1.15 version, but everything works fine with the 1.10.1

can you check @wenzhixin

@wenzhixin but using that version in particular, is how I keep getting this error. I started using 1.10.1 and everything is working as it should.

I used the version that is shown in the documentation:

<script src="https://unpkg.com/[email protected]/dist/bootstrap-table.min.js"></script>
and the example code doesnt work; I keep getting this error. Please verify

@ gadget00 Can you help to provide an Online Example to show the problem?

somehow in the online example, it does work. However in my code I keep getting the same error only if I use the 1.15.3 version. Otherwise, it runs correctly

我也遇到了一样的问题, 用的1.15.4版本, 原来用的1.12.x版本正常,
MacOS 10.14.6
Chrom 76.0.3809.100(正式版本) (64 位)

Uncaught TypeError: Cannot convert object to primitive value
at Object.setFieldIndex (bootstrap-table.min.js:10)
at e.value (bootstrap-table.min.js:10)
at e.value (bootstrap-table.min.js:10)
at new e (bootstrap-table.min.js:10)
at HTMLTableElement. (bootstrap-table.min.js:10)
at Function.each (jquery.min.js:2)
at k.fn.init.each (jquery.min.js:2)
at k.fn.init.t.fn.bootstrapTable (bootstrap-table.min.js:10)
at k.fn.init.createTable (ceec.core.js?v=1.1.0.19040802:392)
at ln.taskList (:127:32)

参数如下:

{
    "idField": "id",
    "striped": true,
    "sidePagination": "server",
    "pagination": true,
    "toolbar": "#toolbar",
    "url": "/ceec-web-console/console/taskinfo/list?taskName=&status=",
    "columns": [{
        "field": "state",
        "checkbox": "taskId"
    }, {
        "field": "taskName",
        "title": "标题",
        "halign": "left",
        "width": "25%"
    }, {
        "field": "sender",
        "title": "创建人",
        "halign": "left"
    }, {
        "field": "stTime",
        "title": "发起时间",
        "halign": "left"
    }, {
        "field": "edTime",
        "title": "截止日期",
        "halign": "left"
    }, {
        "field": "completionStatus",
        "title": "执行情况",
        "halign": "left"
    }, {
        "field": "status",
        "title": "任务状态",
        "halign": "left"
    }, {
        "field": "step",
        "title": "任务进度(%)",
        "halign": "left"
    }, {
        "field": "taskId",
        "title": "操作"
    }],
    "height": 750,
    "pageSize": 15
}

@gadget00 兄弟的问题有没有解决
@wenzhixin 请求支持

排版实再折腾了,将就点看吧

@tenney https://live.bootstrap-table.com/code/wenzhixin/460, it runs correctly.
Can you provide a full example?

@wenzhixin 刚尝试把这个案例单独提出来时发现居然又是正常的, 不知道是不是因为我的工程中有其他js库跟它有冲突, 而且我发现在工程中,当我使用 min版本(即bootstrap-table-min.js)时会有这个问题,换成非min版本又是正常的, 待我再尝试其他方式排查一下,有消息再反馈。

另:反馈一个现象不知是否BUG, 就是当我把bt升级为1.15.4时,原表格各列的宽度完全失控了,经排查发现,原来设定的 colums中的 width 失效了, 具体情况为 设置为 px单位正常, 设置为百分比单位时,全部被转成了 px单位, 如我设置其中某一列width 为 15%,渲染到页面时变成了 15px, 烦请核实!

@tenney 最新的版本增加了widthUnit 的支持,例子:https://examples.bootstrap-table.com/#column-options/width-unit.html ,需要将其设置为 '%' 。

3726

I've the same problem and this is caused by presence in my code of

".../core-js/2.6.2/core.min.js" library

Library is used for problem with IE11.

With 1.13.2 version no problem.

P.S. Also updating to core-js 3.2.1 same problem

I was having this problem when importing non minified bootstrap table with minified print extension.
After changing both for minified it worked!
<script src="https://unpkg.com/[email protected]/dist/bootstrap-table.min.js"></script>
<script src="https://unpkg.com/[email protected]/dist/extensions/print/bootstrap-table-print.min.js"></script>
<script src="https://unpkg.com/[email protected]/dist/extensions/toolbar/bootstrap-table-toolbar.min.js"></script>

It's a silly work-around, but this problem doesn't happen when you load the not minified version of the file:

<script type="text/javascript" src="/libs/js/jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="/libs/popper/umd/popper.min.js"></script>
<script type="text/javascript" src="/libs/bootstrap/js/bootstrap.min.js"></script>
<script type="text/javascript" src="/libs/core-js-2.6.3/client/core.min.js"></script>
<script type="text/javascript" src="/libs/bootstrap-table/bootstrap-table.js"></script></script>

Also using all minified version persist the problem with core-js library (tried core.269.js and core321.js)
If i remove core-js all is ok.
I receive following error.
Any suggestions to skip over ?

TypeError: can't convert Symbol.iterator to string: its [Symbol.toPrimitive] method returned an object bootstrap-table.min.js:10:41878
    setFieldIndex http://localhost:53748/js/libs/bootstrap-table/1.15.4/bootstrap-table.min.js:10
    value http://localhost:53748/js/libs/bootstrap-table/1.15.4/bootstrap-table.min.js:10
    value http://localhost:53748/js/libs/bootstrap-table/1.15.4/bootstrap-table.min.js:10
    value http://localhost:53748/js/libs/bootstrap-table/1.15.4/bootstrap-table-filter-control.min.js:10
    e http://localhost:53748/js/libs/bootstrap-table/1.15.4/bootstrap-table.min.js:10
    n http://localhost:53748/js/libs/bootstrap-table/1.15.4/bootstrap-table-export.min.js:10
    o http://localhost:53748/js/libs/bootstrap-table/1.15.4/bootstrap-table-filter-control.min.js:10
    d http://localhost:53748/js/libs/bootstrap-table/1.15.4/print/bootstrap-table-print.min.js:10
    bootstrapTable http://localhost:53748/js/libs/bootstrap-table/1.15.4/bootstrap-table.min.js:10
    jQuery 2
    bootstrapTable http://localhost:53748/js/libs/bootstrap-table/1.15.4/bootstrap-table.min.js:10
    success http://localhost:53748/Stat/Stat.js:246
    jQuery 4

Fixed in #4634

I have the same problem and I think the right solution for it will be to take [email protected] like it's stated in bootstrap 4.4 documentation.

thanks a lot @StanislavNemytov, I had jquery 3.50....I lost many hours try to fix my issue.....I take [email protected] and it's works

Was this page helpful?
0 / 5 - 0 ratings