function GetColumnBySelectedRows(Col, oGrid){
var myRowsIndex = oGrid.getSelectedRows();
alert(myRowsIndex);
var mySelectedRowsIndex = myRowsIndex.split(","); <-- problem here
alert(mySelectedRowsIndex);
//alert(oGrid.getData(0,SeletedRowsIndex));
//var mySelectedRowsIndex = SeletedRowsIndex.split(",");
//alert(mySelectedRowsIndex);
var rowIndex, iIndex, rowColumnValue = "";
for(iIndex=0; iIndex<aSelectedRowsIndex.length; iIndex++){
rowIndex = aSelectedRowsIndex[iIndex];
rowColumnValue += oGrid.getCellText(Col,rowIndex) + ",";
}
return rowColumnValue;
}
/**
* function dataHandler_exportData(oDatagrid, aDatagridData, aDatagridColumns, bWYSIWYG)
*
* + exports rows in dataGrid
*
* @param oDatagrid object ActiveWidget's grid 1.0 object
* @param aDatagridData array data represented in oDatagrid
* @param aDatagridColumns array array containing the column names
* @param bWYSIWYG boolean if set to true, only visible data is exported; default is TRUE
*
* @returns nothing
*/
function dataHandler_exportData(oDatagrid, aDatagridData, aDatagridColumns, bWYSIWYG)
{
/* init */
var aExportData = new Array();
var aExportColumns = new Array();
var iColumnLength = aDatagridColumns.length;
var iRowLength = aDatagridData.length;
if (bWYSIWYG==null)
{
bWYSIWYG = true;
}
/* get form */
var oForm = document.getElementById(oDatagrid.name+'_actionForm');
//save action and target
sFormAction = oForm.action;
sFormTarget = oForm.target;
//change action and target
oForm.action = 'Helper/exportTable.php?action='+iAction;
oForm.target = '_blank';
/* remove columns/data which arent visible */
if (bWYSIWYG==true)
{
var aiVisibleColumnIndexes = oDatagrid.getColumnValues();
//columns
for (var j=iColumnLength-1; j>=0; j--)
{
if (aiVisibleColumnIndexes.indexOf(j)==-1)
{
//column is not visible: remove entry
aDatagridColumns.splice(j,1);
}
}
//data
for (var i=0; i<iRowLength; i++)
{
for (var j=iColumnLength-1; j>=0; j--)
{
if (aiVisibleColumnIndexes.indexOf(j)==-1)
{
//column is not visible: remove entry
aDatagridData[i].splice(j,1);
}
}
}
}
/* put columns and data in string */
for (var i=0; i<iRowLength; i++) //walk through rows
{
//add column data to export array
aExportData[i] = encodeURIComponent(aDatagridData[i].join(','));
}
(...)
}
/* get selected rows in grid */
var selectedRows = oDatagrid.getSelectionProperty("values");
for (i=0; i<selectedRows.length; i++)
{
aExportData[i] = aDatagridData[selectedRows[i]].join(',');
}
This topic is archived.