Skip to content

Commit

Permalink
slicing now "works", has incorrect behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
telamonian committed Aug 20, 2019
1 parent 5652c76 commit 7c097e2
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 70 deletions.
19 changes: 19 additions & 0 deletions src/dataset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,25 @@ export class HdfDatasetModelBase extends DataModel {
const parts = parseSlice(s);
this._rowSlice = parts[0];
this._colSlice = parts[1];

this.emitChanged({
type: "model-reset"
});

this.emitChanged({
type: "rows-inserted",
region: "body",
index: 0,
span: this.rowCount("body")
});
this.emitChanged({
type: "columns-inserted",
region: "body",
index: 0,
span: this.columnCount("body")
});

this._blocks = Object();
}

/**
Expand Down
70 changes: 0 additions & 70 deletions src/toolbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,82 +49,14 @@ export class SliceInput extends ReactWidget {

this._grid = widget;
this._model = this._grid.model as HdfDatasetModelBase;

// // initialize .value
// this.value = this._model.slice;

// this._component = new SliceInputBox({handleEnter: val => this._model.slice = val});
}

// get value(): string {
// return this._component.state.value;
// }
// set value(val: string) {
// this._component.setState({ value: val });
// }

// /**
// * Handle `keydown` events for the HTMLSelect component.
// */
// private _handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>): void => {
// if (event.keyCode === 13) {
// this._model.slice = event.currentTarget.value;
// }
// };
//
// /**
// * Handle a change to the value in the input field.
// */
// private _handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
// // this.setState({ value: event.currentTarget.value });
// this.value = event.currentTarget.value;
// };

// /**
// * Handle focusing of the input field.
// */
// private _handleFocus = () => {
// this.setState({ hasFocus: true });
// };
//
// /**
// * Handle blurring of the input field.
// */
// private _handleBlur = () => {
// this.setState({ hasFocus: false });
// };

render() {
return <SliceInputBox handleEnter={val => (this._model.slice = val)} />;
// // return (
// // <label>
// // {"Slice: "}
// // <input
// // type="text"
// // className={TOOLBAR_SLICEINPUT_BOX_CLASS}
// // onChange={this._handleChange}
// // // onFocus={this._handleFocus}
// // // onBlur={this._handleBlur}
// // onKeyDown={this._handleKeyDown}
// // aria-label="Slice input"
// // value={this.value}
// //
// // // className={lineFormInput}
// // // ref={input => {
// // // this._textInput = input;
// // // }}
// // />
// // </label>
// // );
// return this._component.render();
}

// value: string = "";

private _grid: DataGrid;
private _model: HdfDatasetModelBase;

// private _component: SliceInputBox;
}

export class SliceInputBox extends React.Component<
Expand Down Expand Up @@ -157,7 +89,6 @@ export class SliceInputBox extends React.Component<
): void => {
if (event.keyCode === 13) {
this.props.handleEnter(event.currentTarget.value);
// this._model.slice = event.currentTarget.value;
}
};

Expand All @@ -166,7 +97,6 @@ export class SliceInputBox extends React.Component<
*/
private _handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
this.setState({ value: event.currentTarget.value });
// this.value = event.currentTarget.value;
};

/**
Expand Down

0 comments on commit 7c097e2

Please sign in to comment.