message: Work for - Support Rubric functionality in Matrix question (cell selection, react)
diff: @@ -89,22 +89,44 @@ export class SurveyQuestionMatrixRow extends ReactSurveyElement {
  var rowText = this.renderLocString(this.row.locText);
  firstTD = <td>{rowText}</td>;
  }
  + var tds = this.generateTds();
  + return (
  + <tr>
  + {firstTD}
  + {tds}
  + </tr>
  + );
  + }
  +
  + generateTds() {
  var tds = [];
  + var row = this.row;
  +
  for (var i = 0; i < this.question.columns.length; i++) {
  + var td = null;
  var column = this.question.columns[i];
  var key = "value" + i;
  - var isChecked = this.row.value == column.value;
  - let itemClass = this.cssClasses.label + (isChecked ? " checked" : "");
  +
  + var isChecked = row.value == column.value;
  + let itemClass = this.getItemClass(row, column);
  var inputId = this.isFirst && i === 0 ? this.question.inputId : null;
  + var getHandler = column => () => this.cellClick(row, column);
  - var td = (
  + if (this.question.hasCellText) {
  + td = (
  + <td key={key} className={itemClass} onClick={getHandler(column)}>
  + {this.question.getCellDisplayText(row.name, column)}
  + </td>
  + );
  + } else {
  + td = (
  <td key={key}>
  <label className={itemClass}>
  <input
  id={inputId}
  type="radio"
  className={this.cssClasses.itemValue}
  - name={this.row.fullName}
  + name={row.fullName}
  value={column.value}
  disabled={this.isDisplayMode}
  checked={isChecked}
  @@ -119,14 +141,27 @@ export class SurveyQuestionMatrixRow extends ReactSurveyElement {
  </label>
  </td>
  );
  + }
  tds.push(td);
  }
  - return (
  - <tr>
  - {firstTD}
  - {tds}
  - </tr>
  - );
  +
  + return tds;
  + }
  +
  + getItemClass(row, column) {
  + var isChecked = row.value == column.value;
  + var cellSelectedClass = this.question.hasCellText
  + ? this.cssClasses.cellTextSelected
  + : "checked";
  + var cellClass = this.question.hasCellText
  + ? this.cssClasses.cellText
  + : this.cssClasses.label;
  + let itemClass = cellClass + (isChecked ? " " + cellSelectedClass : "");
  + return itemClass;
  + }
  +
  + cellClick(row, column) {
  + row.value = column.value;
  }
  }
  