hi faizan, Not sure if you were referring to this active widget (http://v2.activewidgets.com/general.demos/basic-grid.html)
If so, below is the class and VF-page to help you.
Apex-Class:
public class Class_906F0000000D9jyIAC
{
public String AcctText;
public Class_906F0000000D9jyIAC() {
AcctText = '[';
for (Account a : [SELECT Id, Name, Phone, Fax, Type FROM Account]) {
AcctText += '["' + a.Id + '","' + a.Name + '","' + a.Phone + '","' + a.Fax + '","' + a.Type + '"],';
}
AcctText += ']';
system.debug('***DEBUG***' + AcctText);
}
public String getAcctText() { return AcctText; }
}
VF-page:
<apex:page title="ActiveWidgets Examples" controller="Class_906F0000000D9jyIAC">
<style type="text/css">
.aw-quirks * { box-sizing: border-box; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; }
body {font: 12px Tahoma}
#myGrid {height: 200px; width: 100%;}
#myGrid .aw-row-selector {text-align: center}
#myGrid .aw-column-0 {width: 80px;}
#myGrid .aw-column-1 {width: 200px;}
#myGrid .aw-column-2 {text-align: right;}
#myGrid .aw-column-3 {text-align: right;}
#myGrid .aw-column-4 {text-align: right;}
#myGrid .aw-grid-cell {border-right: 1px solid threedlightshadow;}
#myGrid .aw-grid-row {border-bottom: 1px solid threedlightshadow;}
/* box model fix for strict doctypes, safari */
.aw-strict #myGrid .aw-grid-cell {padding-right: 3px;}
.aw-strict #myGrid .aw-grid-row {padding-bottom: 3px;}
</style>
<link href="{!$Resource.activewidgetCSS}" rel="stylesheet" />
<script src="{!$Resource.activewidget}"></script>
<script type="text/javascript">
var myData = {!AcctText};
var myColumns = [
"Id", "Company Name", "Billing Street", "Billing City", "Phone"
];
// create ActiveWidgets Grid javascript object
var obj = new AW.UI.Grid;
obj.setId("myGrid");
// define data formats
var str = new AW.Formats.String;
var num = new AW.Formats.Number;
obj.setCellFormat([str, str, num, num, num]);
// provide cells and headers text
obj.setCellText(myData);
obj.setHeaderText(myColumns);
// set number of rows/columns
obj.setRowCount(20);
obj.setColumnCount(5);
// enable row selectors
obj.setSelectorVisible(true);
obj.setSelectorText(function(i){return this.getRowPosition(i)+1});
// set headers width/height
obj.setSelectorWidth(28);
obj.setHeaderHeight(20);
// set row selection
obj.setSelectionMode("single-row");
// set click action handler
obj.onCellClicked = function(event, col, row){window.status = this.getCellText(col, row)};
// write grid html to the page
document.write(obj);
</script>
</apex:page>
If the above suggestion worked, let us know by marking the answer as "Best Answer" right under the comment which will help the rest of the community should they have a similar issue in the future. Thanks, Sunil
hi faizan, Not sure if you were referring to this active widget (http://v2.activewidgets.com/general.demos/basic-grid.html)
If so, below is the class and VF-page to help you.
Apex-Class:
public class Class_906F0000000D9jyIAC
{
public String AcctText;
public Class_906F0000000D9jyIAC() {
AcctText = '[';
for (Account a : [SELECT Id, Name, Phone, Fax, Type FROM Account]) {
AcctText += '["' + a.Id + '","' + a.Name + '","' + a.Phone + '","' + a.Fax + '","' + a.Type + '"],';
}
AcctText += ']';
system.debug('***DEBUG***' + AcctText);
}
public String getAcctText() { return AcctText; }
}
VF-page:
<apex:page title="ActiveWidgets Examples" controller="Class_906F0000000D9jyIAC">
<style type="text/css">
.aw-quirks * { box-sizing: border-box; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; }
body {font: 12px Tahoma}
#myGrid {height: 200px; width: 100%;}
#myGrid .aw-row-selector {text-align: center}
#myGrid .aw-column-0 {width: 80px;}
#myGrid .aw-column-1 {width: 200px;}
#myGrid .aw-column-2 {text-align: right;}
#myGrid .aw-column-3 {text-align: right;}
#myGrid .aw-column-4 {text-align: right;}
#myGrid .aw-grid-cell {border-right: 1px solid threedlightshadow;}
#myGrid .aw-grid-row {border-bottom: 1px solid threedlightshadow;}
/* box model fix for strict doctypes, safari */
.aw-strict #myGrid .aw-grid-cell {padding-right: 3px;}
.aw-strict #myGrid .aw-grid-row {padding-bottom: 3px;}
</style>
<link href="{!$Resource.activewidgetCSS}" rel="stylesheet" />
<script src="{!$Resource.activewidget}"></script>
<script type="text/javascript">
var myData = {!AcctText};
var myColumns = [
"Id", "Company Name", "Billing Street", "Billing City", "Phone"
];
// create ActiveWidgets Grid javascript object
var obj = new AW.UI.Grid;
obj.setId("myGrid");
// define data formats
var str = new AW.Formats.String;
var num = new AW.Formats.Number;
obj.setCellFormat([str, str, num, num, num]);
// provide cells and headers text
obj.setCellText(myData);
obj.setHeaderText(myColumns);
// set number of rows/columns
obj.setRowCount(20);
obj.setColumnCount(5);
// enable row selectors
obj.setSelectorVisible(true);
obj.setSelectorText(function(i){return this.getRowPosition(i)+1});
// set headers width/height
obj.setSelectorWidth(28);
obj.setHeaderHeight(20);
// set row selection
obj.setSelectionMode("single-row");
// set click action handler
obj.onCellClicked = function(event, col, row){window.status = this.getCellText(col, row)};
// write grid html to the page
document.write(obj);
</script>
</apex:page>
If the above suggestion worked, let us know by marking the answer as "Best Answer" right under the comment which will help the rest of the community should they have a similar issue in the future. Thanks, Sunil
If so, below is the class and VF-page to help you.
Apex-Class:
VF-page:
If the above suggestion worked, let us know by marking the answer as "Best Answer" right under the comment which will help the rest of the community should they have a similar issue in the future.
Thanks, Sunil
All Answers
If so, below is the class and VF-page to help you.
Apex-Class:
VF-page:
If the above suggestion worked, let us know by marking the answer as "Best Answer" right under the comment which will help the rest of the community should they have a similar issue in the future.
Thanks, Sunil