Skip to content

Commit

Permalink
adjusts
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul committed Apr 5, 2024
1 parent 5ee1b6e commit 4de429f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,5 +236,5 @@ The LemonadeJS data grid is released under the MIT.

## Other Tools

- [jSuites](https://jsuites.net/v4/)
- [jSuites](https://jsuites.net)
- [Jspreadsheet](https://jspreadsheet.com)
2 changes: 2 additions & 0 deletions dist/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ declare namespace Datagrid {
width?: string;
/** Render */
render?: () => void;
/** Wrap the text */
wrap?: Boolean;
}

interface Item {
Expand Down
18 changes: 12 additions & 6 deletions src/datagrid.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/**
* (c) LemonadeJS Data Grid
*
* Website: https://lemonadejs.net
* MIT License
*/
* (c) LemonadeJS Data Grid
*
* Website: https://lemonadejs.net
* MIT License
*/

// Load LemonadeJS
if (! lemonade && typeof(require) === 'function') {
Expand Down Expand Up @@ -433,9 +433,15 @@ if (! lemonade && typeof(require) === 'function') {
// Build the columns structure
self.columns.forEach((v, k) => {
columns += `<td ondblclick="self.parent.edit" onblur="self.parent.edit" align="${v.align}"`;
if (! v.width) {
v.width = 100;
}
if (v.render) {
columns += ` :ready="self.parent.render"`;
}
if (v.wrap) {
columns += ` class="lm-data-grid-wrap"`;
}
if (v.name) {
columns += ` data-name="${v.name}">{{self.${v.name}}}</td>`;
} else {
Expand All @@ -445,7 +451,7 @@ if (! lemonade && typeof(require) === 'function') {
});

return `<div class="lm-data-grid" :data="self.data" onkeydown="self.keydown">
<div class="lm-data-grid-search-section" search="{{self.search}}">Search: <input type='text' :bind="self.input"/></div>
<div class="lm-data-grid-search-section" search="{{self.search}}"><div>Search</div> <div><input type='text' :bind="self.input"/></div></div>
<table class="lm-data-grid-table">
<thead><tr :loop="self.columns"><th width="{{self.width}}" align="{{self.align}}" data-sorted="{{self.sorted}}" onclick="self.parent.sort">{{self.title}}</th></tr></thead>
<tbody :loop="self.result"><tr>${columns}</tr></tbody>
Expand Down

0 comments on commit 4de429f

Please sign in to comment.