gd-bs 6.9.13 → 6.9.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/components/table/index.js +36 -1
- package/dist/gd-bs-icons.js +1 -1
- package/dist/gd-bs-icons.min.js +1 -1
- package/dist/gd-bs.d.ts +4 -0
- package/dist/gd-bs.js +1 -1
- package/dist/gd-bs.min.js +1 -1
- package/package.json +1 -1
- package/src/components/table/index.ts +41 -1
- package/src/components/table/types.d.ts +4 -0
package/package.json
CHANGED
|
@@ -174,7 +174,7 @@ class _Table extends Base<ITableProps> implements ITable {
|
|
|
174
174
|
|
|
175
175
|
// Renders a row
|
|
176
176
|
private renderRow(row: HTMLTableRowElement, data, rowIdx: number) {
|
|
177
|
-
//
|
|
177
|
+
// Parse the columns
|
|
178
178
|
for (let i = 0; i < this.props.columns.length; i++) {
|
|
179
179
|
// Create the cell
|
|
180
180
|
this.renderCell(row, this.props.columns[i], data, rowIdx);
|
|
@@ -206,5 +206,45 @@ class _Table extends Base<ITableProps> implements ITable {
|
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
208
|
}
|
|
209
|
+
|
|
210
|
+
// Method to update a column element
|
|
211
|
+
updateColumn(elCol: HTMLElement, colIdx: number, row: any) {
|
|
212
|
+
// Get the column
|
|
213
|
+
let colProps = this.props.columns[colIdx];
|
|
214
|
+
if (colProps) {
|
|
215
|
+
// Set the value
|
|
216
|
+
elCol.innerHTML = row[colProps.name] == null ? "" : row[colProps.name];
|
|
217
|
+
|
|
218
|
+
// See if there is an event for this column
|
|
219
|
+
if (colProps.onRenderCell) {
|
|
220
|
+
// Call the event
|
|
221
|
+
colProps.onRenderCell(elCol as HTMLTableCellElement, colProps, row);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
// See if there is an event for this component
|
|
225
|
+
if (this.props.onRenderCell) {
|
|
226
|
+
// Call the event
|
|
227
|
+
this.props.onRenderCell(elCol as HTMLTableCellElement, colProps, row);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
// Method to update a row element
|
|
233
|
+
updateRow(elRow: HTMLElement, row: any) {
|
|
234
|
+
// Parse the columns
|
|
235
|
+
for (let i = 0; i < this.props.columns.length; i++) {
|
|
236
|
+
let elCol = elRow.children[i] as HTMLElement;
|
|
237
|
+
if (elCol) {
|
|
238
|
+
// Update the column
|
|
239
|
+
this.updateColumn(elCol, i, row);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
// See if there is an event
|
|
244
|
+
if (this.props.onRenderRow) {
|
|
245
|
+
// Call the event
|
|
246
|
+
this.props.onRenderRow(elRow as HTMLTableRowElement, row);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
209
249
|
}
|
|
210
250
|
export const Table = (props: ITableProps, template?: string): ITable => { return new _Table(props, template); }
|