future-architect/cheetah-grid

Error: content.slice is not a function

Sherhang opened this issue · 6 comments

When using cheetah-grid in superset1.0.1,somtimes this error occurs:
js Chart.jsx?c775:137 TypeError: content.slice is not a function at breakWidth (webpack-internal:///./node_modules/cheetah-grid/dist/cheetahGrid.es5.js:18728) at Inline.breakAll (webpack-internal:///./node_modules/cheetah-grid/dist/cheetahGrid.es5.js:18832) at truncateInlines (webpack-internal:///./node_modules/cheetah-grid/dist/cheetahGrid.es5.js:1857) at _inlineRect (webpack-internal:///./node_modules/cheetah-grid/dist/cheetahGrid.es5.js:1888) at eval (webpack-internal:///./node_modules/cheetah-grid/dist/cheetahGrid.es5.js:2485) at GridCanvasHelper.drawWithClip (webpack-internal:///./node_modules/cheetah-grid/dist/cheetahGrid.es5.js:2394) at GridCanvasHelper.text (webpack-internal:///./node_modules/cheetah-grid/dist/cheetahGrid.es5.js:2472) at eval (webpack-internal:///./node_modules/cheetah-grid/dist/cheetahGrid.es5.js:12105) at Object.loadIcons (webpack-internal:///./node_modules/cheetah-grid/dist/cheetahGrid.es5.js:13178) at Column.drawInternal (webpack-internal:///./node_modules/cheetah-grid/dist/cheetahGrid.es5.js:12104)

Thank you for this issue. Would you please provide a repository to reproduce the issue?

The issue occurs in the following demo:
`<script src="https://unpkg.com/cheetah-grid@0.22"></script>

<script> const grid = new cheetahGrid.ListGrid({ parentElement: document.getElementById('demo'), header: [{ "field": "device", "caption": "设备", "width": "calc(12.25%)", "columnType": "string", "sort": true, "headerStyle": { "color": "#000000", "font": "bolder 12px sans-serif", "textAlign": "center", "textOverflow": "ellipsis" }, "style": { "textAlign": "center", "font": "12px sans-serif", "textOverflow": "ellipsis" }, "message": null }, { "field": "productversion_s", "caption": "版本号", "width": "calc(12.25%)", "columnType": "string", "sort": true, "headerStyle": { "color": "#000000", "font": "bolder 12px sans-serif", "textAlign": "center", "textOverflow": "ellipsis" }, "style": { "textAlign": "center", "font": "12px sans-serif", "textOverflow": "ellipsis" }, "message": null }, { "field": "期望触发home数", "caption": "期望触发home数", "width": "calc(12.25%)", "columnType": "string", "sort": true, "headerStyle": { "color": "#000000", "font": "bolder 12px sans-serif", "textAlign": "center", "textOverflow": "ellipsis" }, "style": { "textAlign": "center", "font": "12px sans-serif", "textOverflow": "ellipsis" }, "message": null }, { "field": "成功触发home数", "caption": "成功触发home数", "width": "calc(12.25%)", "columnType": "string", "sort": true, "headerStyle": { "color": "#000000", "font": "bolder 12px sans-serif", "textAlign": "center", "textOverflow": "ellipsis" }, "style": { "textAlign": "center", "font": "12px sans-serif", "textOverflow": "ellipsis" }, "message": null }, { "field": "成功率(%)", "caption": "成功率(%)", "width": "calc(12.25%)", "columnType": "string", "sort": true, "headerStyle": { "color": "#000000", "font": "bolder 12px sans-serif", "textAlign": "center", "textOverflow": "ellipsis" }, "style": { "textAlign": "center", "font": "12px sans-serif", "textOverflow": "ellipsis" }, "message": null }, { "field": "误触发home数", "caption": "误触发home数", "width": "calc(12.25%)", "columnType": "string", "sort": true, "headerStyle": { "color": "#000000", "font": "bolder 12px sans-serif", "textAlign": "center", "textOverflow": "ellipsis" }, "style": { "textAlign": "center", "font": "12px sans-serif", "textOverflow": "ellipsis" }, "message": null }, { "field": "回home总数", "caption": "回home总数", "width": "calc(12.25%)", "columnType": "string", "sort": true, "headerStyle": { "color": "#000000", "font": "bolder 12px sans-serif", "textAlign": "center", "textOverflow": "ellipsis" }, "style": { "textAlign": "center", "font": "12px sans-serif", "textOverflow": "ellipsis" }, "message": null }, { "field": "误触发home率(%)", "caption": "误触发home率(%)", "width": "calc(12.25%)", "columnType": "string", "sort": true, "headerStyle": { "color": "#000000", "font": "bolder 12px sans-serif", "textAlign": "center", "textOverflow": "ellipsis" }, "style": { "textAlign": "center", "font": "12px sans-serif", "textOverflow": "ellipsis" }, "message": null }], frozenColCount: 0, defaultRowHeight: 20, headerRowHeight: 40, }); // set array records function generateRecords(n) { var res = []; for (let i = 0; i < n; ++i) { res.push({ 'personid': (i + 1) / 2, 'fname': 'Person' + i, 'lname': 'DE', 'email': 'gd哈行昂dfgwerahgrffgrefsophia_hill@example.com' }) } return res; } grid.records = [{ "device": "GRE", "productversion_s": "GRE-9.1.1.15", "期望触发home数": 177, "成功触发home数": 166, "成功率(%)": 93.78531073446328, "误触发home数": 0, "回home总数": 166, "误触发home率(%)": 0 }, { "device": "GRE", "productversion_s": "GRE-9.1.1.37", "期望触发home数": 8, "成功触发home数": 8, "成功率(%)": 100, "误触发home数": 0, "回home总数": 8, "误触发home率(%)": 0 }, { "device": "GRE", "productversion_s": "GRE-9.1.1.38", "期望触发home数": 310, "成功触发home数": 293, "成功率(%)": 94.51612903225806, "误触发home数": 1, "回home总数": 294, "误触发home率(%)": 0.3401360544217687 }, { "device": "GRE", "productversion_s": "GRE-9.1.1.39", "期望触发home数": 87126, "成功触发home数": 80880, "成功率(%)": 92.83107224020384, "误触发home数": 89, "回home总数": 80969, "误触发home率(%)": 0.10991861082636564 }, { "device": "GRE", "productversion_s": "GRE-9.1.1.40", "期望触发home数": 63113, "成功触发home数": 58591, "成功率(%)": 92.83507359814935, "误触发home数": 89, "回home总数": 58680, "误触发home率(%)": 0.15167007498295842 }, { "device": "GRE", "productversion_s": "GRE-9.1.1.41", "期望触发home数": 88990, "成功触发home数": 82922, "成功率(%)": 93.18125632093493, "误触发home数": 130, "回home总数": 83052, "误触发home率(%)": 0.15652844001348554 }, { "device": "GRE", "productversion_s": "GRE-9.1.1.42", "期望触发home数": 361120, "成功触发home数": 336621, "成功率(%)": 93.21582853345149, "误触发home数": 487, "回home总数": 337108, "误触发home率(%)": 0.144464088660014 }, { "device": "GRE", "productversion_s": "GRE-9.1.1.43", "期望触发home数": 133458, "成功触发home数": 124277, "成功率(%)": 93.12068216217837, "误触发home数": 168, "回home总数": 124445, "误触发home率(%)": 0.13499939732411909 }, { "device": "KUL", "productversion_s": "KUL-11.0.0.165", "期望触发home数": 618, "成功触发home数": 586, "成功率(%)": 94.8220064724919, "误触发home数": 0, "回home总数": 586, "误触发home率(%)": 0 }, { "device": "KUL", "productversion_s": "KUL-11.0.0.170", "期望触发home数": 5, "成功触发home数": 5, "成功率(%)": 100, "误触发home数": 0, "回home总数": 5, "误触发home率(%)": 0 }, { "device": "KUL", "productversion_s": "KUL-11.0.0.38", "期望触发home数": 47, "成功触发home数": 47, "成功率(%)": 100, "误触发home数": 0, "回home总数": 47, "误触发home率(%)": 0 }, { "device": "KUL", "productversion_s": "KUL-11.0.0.39", "期望触发home数": 11877, "成功触发home数": 11237, "成功率(%)": 94.61143386377032, "误触发home数": 8, "回home总数": 11245, "误触发home率(%)": 0.07114273010226767 }, { "device": "KUL", "productversion_s": "KUL-11.0.0.40", "期望触发home数": 11222, "成功触发home数": 10614, "成功率(%)": 94.58207093209766, "误触发home数": 7, "回home总数": 10621, "误触发home率(%)": 0.0659071650503719 }, { "device": "KUL", "productversion_s": "KUL-11.0.0.41", "期望触发home数": 23158, "成功触发home数": 21873, "成功率(%)": 94.45116158562915, "误触发home数": 18, "回home总数": 21891, "误触发home率(%)": 0.08222557215293956 }, { "device": "KUL", "productversion_s": "KUL-11.0.0.42", "期望触发home数": 79128, "成功触发home数": 74725, "成功率(%)": 94.43559801840057, "误触发home数": 57, "回home总数": 74782, "误触发home率(%)": 0.07622155064052846 }, { "device": "KUL", "productversion_s": "KUL-11.0.0.43", "期望触发home数": 52709, "成功触发home数": 49703, "成功率(%)": 94.29698912899126, "误触发home数": 89, "回home总数": 49792, "误触发home率(%)": 0.1787435732647815 }, { "device": "LAN", "productversion_s": "LAN-11.0.0.165", "期望触发home数": 124, "成功触发home数": 114, "成功率(%)": 91.93548387096774, "误触发home数": 0, "回home总数": 114, "误触发home率(%)": 0 }, { "device": "LAN", "productversion_s": "LAN-11.0.0.170", "期望触发home数": 293, "成功触发home数": 279, "成功率(%)": 95.22184300341297, "误触发home数": 1, "回home总数": 280, "误触发home率(%)": 0.35714285714285715 }, { "device": "LAN", "productversion_s": "LAN-11.0.0.38", "期望触发home数": 810, "成功触发home数": 778, "成功率(%)": 96.04938271604938, "误触发home数": 0, "回home总数": 778, "误触发home率(%)": 0 }, { "device": "LAN", "productversion_s": "LAN-11.0.0.39", "期望触发home数": 58460, "成功触发home数": 55356, "成功率(%)": 94.69038658912076, "误触发home数": 41, "回home总数": 55397, "误触发home率(%)": 0.07401122804483998 }, { "device": "LAN", "productversion_s": "LAN-11.0.0.40", "期望触发home数": 51809, "成功触发home数": 49189, "成功率(%)": 94.94296357775676, "误触发home数": 34, "回home总数": 49223, "误触发home率(%)": 0.06907340064603945 }, { "device": "LAN", "productversion_s": "LAN-11.0.0.41", "期望触发home数": 56828, "成功触发home数": 53916, "成功率(%)": 94.87576546772718, "误触发home数": 33, "回home总数": 53949, "误触发home率(%)": 0.06116888172162598 }, { "device": "LAN", "productversion_s": "LAN-11.0.0.42", "期望触发home数": 180376, "成功触发home数": 171118, "成功率(%)": 94.86738812258837, "误触发home数": 89, "回home总数": 171207, "误触发home率(%)": 0.05198385580028854 }, { "device": "LAN", "productversion_s": "LAN-11.0.0.43", "期望触发home数": 85364, "成功触发home数": 80853, "成功率(%)": 94.71557096668384, "误触发home数": 50, "回home总数": 80903, "误触发home率(%)": 0.06180240534961621 }, { "device": "LAN", "productversion_s": "LAN-11.0.0.44", "期望触发home数": 146, "成功触发home数": 144, "成功率(%)": 98.63013698630137, "误触发home数": 0, "回home总数": 144, "误触发home率(%)": 0 }, { "device": "LAN", "productversion_s": "LAN-11.0.0.45", "期望触发home数": 66, "成功触发home数": 61, "成功率(%)": 92.42424242424242, "误触发home数": 0, "回home总数": 61, "误触发home率(%)": 0 }, { "device": "LAN", "productversion_s": "LAN-11.0.0.47", "期望触发home数": 44, "成功触发home数": 41, "成功率(%)": 93.18181818181819, "误触发home数": 0, "回home总数": 41, "误触发home率(%)": 0 }, { "device": "LAN", "productversion_s": "LAN-11.0.0.48", "期望触发home数": 2, "成功触发home数": 2, "成功率(%)": 100, "误触发home数": 0, "回home总数": 2, "误触发home率(%)": 0 }, { "device": "LIO", "productversion_s": "LIO-11.0.0.40", "期望触发home数": 20752, "成功触发home数": 19497, "成功率(%)": 93.95239013107171, "误触发home数": 3, "回home总数": 19500, "误触发home率(%)": 0.015384615384615385 }, { "device": "LIO", "productversion_s": "LIO-11.0.0.41", "期望触发home数": 46382, "成功触发home数": 43526, "成功率(%)": 93.84243887715061, "误触发home数": 11, "回home总数": 43537, "误触发home率(%)": 0.02526586581528355 }, { "device": "LIO", "productversion_s": "LIO-11.0.0.42", "期望触发home数": 49495, "成功触发home数": 46510, "成功率(%)": 93.96908778664512, "误触发home数": 9, "回home总数": 46519, "误触发home率(%)": 0.0193469335110385 }, { "device": "LIO", "productversion_s": "LIO-11.0.0.43", "期望触发home数": 19280, "成功触发home数": 18150, "成功率(%)": 94.1390041493776, "误触发home数": 7, "回home总数": 18157, "误触发home率(%)": 0.03855262433221347 }, { "device": "LIO", "productversion_s": "LIO-11.0.0.44", "期望触发home数": 7, "成功触发home数": 7, "成功率(%)": 100, "误触发home数": 0, "回home总数": 7, "误触发home率(%)": 0 }, { "device": "RAI", "productversion_s": "RAI-11.0.0.165", "期望触发home数": 455, "成功触发home数": 433, "成功率(%)": 95.16483516483517, "误触发home数": 0, "回home总数": 433, "误触发home率(%)": 0 }, { "device": "RAI", "productversion_s": "RAI-11.0.0.37", "期望触发home数": 217, "成功触发home数": 202, "成功率(%)": 93.08755760368663, "误触发home数": 0, "回home总数": 202, "误触发home率(%)": 0 }, { "device": "RAI", "productversion_s": "RAI-11.0.0.38", "期望触发home数": 109, "成功触发home数": 101, "成功率(%)": 92.66055045871559, "误触发home数": 0, "回home总数": 101, "误触发home率(%)": 0 }, { "device": "RAI", "productversion_s": "RAI-11.0.0.39", "期望触发home数": 13106, "成功触发home数": 12321, "成功率(%)": 94.01037692659851, "误触发home数": 16, "回home总数": 12337, "误触发home率(%)": 0.12969117289454488 }, { "device": "RAI", "productversion_s": "RAI-11.0.0.40", "期望触发home数": 23258, "成功触发home数": 21987, "成功率(%)": 94.53521368991315, "误触发home数": 5, "回home总数": 21992, "误触发home率(%)": 0.022735540196435068 }, { "device": "RAI", "productversion_s": "RAI-11.0.0.41", "期望触发home数": 34888, "成功触发home数": 32884, "成功率(%)": 94.25590460903463, "误触发home数": 22, "回home总数": 32906, "误触发home率(%)": 0.0668571081261776 }, { "device": "RAI", "productversion_s": "RAI-11.0.0.42", "期望触发home数": 108742, "成功触发home数": 102915, "成功率(%)": 94.6414448878998, "误触发home数": 65, "回home总数": 102980, "误触发home率(%)": 0.063119052243154 }, { "device": "RAI", "productversion_s": "RAI-11.0.0.43", "期望触发home数": 48819, "成功触发home数": 46409, "成功率(%)": 95.06339744771503, "误触发home数": 27, "回home总数": 46436, "误触发home率(%)": 0.05814454302696184 }, { "device": "TXL", "productversion_s": "TXL-11.0.0.135", "期望触发home数": 12, "成功触发home数": 12, "成功率(%)": 100, "误触发home数": 0, "回home总数": 12, "误触发home率(%)": 0 }, { "device": "TXL", "productversion_s": "TXL-11.0.0.42", "期望触发home数": 45, "成功触发home数": 45, "成功率(%)": 100, "误触发home数": 0, "回home总数": 45, "误触发home率(%)": 0 }, { "device": "TXL", "productversion_s": "TXL-11.0.0.43", "期望触发home数": 811, "成功触发home数": 789, "成功率(%)": 97.28729963008631, "误触发home数": 3, "回home总数": 792, "误触发home率(%)": 0.3787878787878788 }, { "device": "TXL", "productversion_s": "TXL-9.1.1.41", "期望触发home数": 103, "成功触发home数": 100, "成功率(%)": 97.0873786407767, "误触发home数": 0, "回home总数": 100, "误触发home率(%)": 0 }]; </script> `

It seems that this property leads to the issue
"style": { "textAlign": "center", "font": "12px sans-serif", // "textOverflow": "ellipsis" // this line leads to the issue }, "message": null

Your source code doesn't work. Please provide the repository. Otherwise I will close this issue.

You should open the HTML code by opening a http port. I open it in VScode.
image

I can't check the issue so I will close this issue.