You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So in a new template which I've mostly re-used the rhtml-colors.html template,
I'm giving in numbers which are percent type.
Unfortunately, I'm not very good at javascript, but I'm getting the error of
not defined "_" from console, when I added the extension script.
Could you help me understand.
<script>
(
function () {
_.extend(KingTable.Schemas.DefaultByType, {
percent: function (columnSchema, objSchema) {
return {
format: function (value) {
// TODO: implement your formatting logic
// (for thousands separator, decimal separators) - culture dependent
return value * 100 + " %";
}
};
}
});
var table = window.table = new KingTable({
id: "data-table",
url: "/api/mydata",
caption: "KingTable - portfolio demo with server side pagination (paginated set in memory)",
element: document.getElementById("main"),
columns: {
{{ instruct|safe }}
}
});
table.render().then(function () {
console.log("ok :)");
}, function () {
console.log("noo :(");
});
}
)();
The text was updated successfully, but these errors were encountered:
Hi @masterfulEJ,
In my code, the variable '_' is imported, that's why it works in my source code but not in your context.
You need to import the same module, if you are using the new EcmaScript with transpilation. Otherwise, you need a global variable with compatible methods, such as Lodash library.
I am intentionally calling this variable _ because it contains general purpose functions, similar to what you can find in Lodash.
So in a new template which I've mostly re-used the rhtml-colors.html template,
I'm giving in numbers which are percent type.
Unfortunately, I'm not very good at javascript, but I'm getting the error of
not defined "_" from console, when I added the extension script.
Could you help me understand.
The text was updated successfully, but these errors were encountered: