Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ezhov-da/2f2416a6c48150f2a4c52e3189e83781 to your computer and use it in GitHub Desktop.
Save ezhov-da/2f2416a6c48150f2a4c52e3189e83781 to your computer and use it in GitHub Desktop.
получение текста из выделенных строк таблицы
function getTextFromSelectedRowGridPanel(gridPanel){
var resultManyRow = '';
var selectionModel = gridPanel.getSelectionModel().getSelection();
if(selectionModel.length > 0){
var columns = gridPanel.columns;
for(var i = 0; i < selectionModel.length; i++){
var object = selectionModel[i];
var objectRawData = object.raw;
var dataResult = [];
for (var c = 0; c < columns.length; c++){
var name = columns[c].text;
var value = objectRawData[columns[c].dataIndex];
dataResult.push(name + ": " + value);
}
var resultText = '';
for(var i = 0; i < dataResult.length; i++){
resultText = resultText + dataResult[i] + "\n";
}
resultManyRow = resultManyRow + resultText + "\n";
}
}
return resultManyRow.trim();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment