Wednesday, March 27, 2019

Add DevExpress Report Dynamically

Here is the way by which we can add report dynamically to some other report. There is one report which is already there but in some case where we want to add some other report to the main report dynamically or conditionally, we can do so by below way.

(1) Main Report which is already there with some implementation but can also have any other report added to this report dynamically
mainReport mymainReport = new mainReport();

(2) Declare a subreport which is already there but need to add to above main report
XRSubreport otherReport = new XRSubreport();

(3) subrepor which need to add
subReport subReporDetail = new subReport();
... here we can perform some data manipulation for subReport and finally assign it to subreport
otherReport.ReportSource = subReporDetail;

(4) Declare a DetailReportBand and DetailBand 
DetailReportBand detailReportBand = new DetailReportBand();
DetailBand subDetailBand = new DetailBand();

(5) Assign subdetailband height and add otherReport to it
subDetailBaind.HeightF = 0;
subDetailBaind.Controls.Add(otherReport);

(6) Add subDetailBand to detailReportBand
detailReportBand.Bands.Add(subDetailBand);

(7) Finally add detailReportBand to main report which will add this report dynamically
mymainReport.Bands.Add(detailReportBand);

This way we can add report dynamically. In step - (3), If there are many reports already created and conditionally we have to load any report then in this step we can check and add required report dynamically.


Monday, March 25, 2019

Working with DevExpress Reporting

Here is some links by which you can bind your devexpress report with datasource.

(A) Devexpress Reporting: Below are link for what is devexpress reporting and its general information.
(1) Devexpress Reporting

(2) General Information


(B) Bind Report: Below are links by which we can bind report with dynamic data from database.
(1) Bind a Report to a Data Source Schema

(2) Bind a Report to a Stored Procedure

(3) Bind a Report to an MDB Database (Runtime Sample)


(C) To load report below are the steps
(1) Register your assembly to page
<%@ Register Assembly="Your DevExpress.XtraReports Assembly" Namespace="DevExpress.XtraReports.Web" TagPrefix="dx" %>

(2) Define your ReportToolbar and ReportViewer


(3) Assign your report from code
myReport rpt1 = myReport();
rtDashboard.ReportViewer = rvDashboard;
rvDashboard.Report = rptESR;

This way you will get your report loaded to the page.

Saturday, March 2, 2019

jqxGrid APIs

Here are some commands & events that are used for jqxGrid processing. Below are the list of commands that may useful.

(1) $('#jqxGrid').jqxGrid('showrowdetails', 2);
- shows details grid of index 2

(2) $('#jqxGrid').jqxGrid('hiderowdetails', 2);
- hides details grid of index 2

(3) $('#jqxGrid').jqxGrid('expandallgroups');
- expand all groups of grid

(4) $('#jqxGrid').jqxGrid('refreshdata');
- refreshes grid data

(5) $("#jqxGrid").trigger("reloadGrid")
- triggers reload event of jqxgrid

(6) $('#jqxGrid').jqxGrid('destroy');
- destroys grid

(7) $('#jqxGrid').jqxGrid('getrows')
- gets rows of jqxgrid

(8) $('#jqxGrid').jqxGrid('clearselection');
- clears selection of any row in grid

(9) $('#jqxGrid').jqxGrid('updatebounddata', 'cells');
- updates bound data of cell

(10) $("#jqxGrid").jqxGrid('cleargriddata');
- clears grid data

(11) $("#jqxGrid").jqxGrid('updatebounddata');
- update bound data

(12) $("#jqxGrid").jqxGrid('refresh');
- refreshes grid

(13) $('#jqxGrid').jqxGrid('getrowdetails', index);
- gets row details of specified "index"

(14) $("#jqxGrid").jqxGrid('getrowdata', $("#jqxGrid").jqxGrid('getselectedrowindex'));
- gets rowdata of the selected row

(15) $('#jqxGrid').jqxGrid('getselectedrowindex');
- gets row index of he selected row

(16) $("#jqxGrid").jqxGrid('setcellvalue', currRow, colName, newVal);
- sets cell value for the specified row and column with new value

(17) var position = $.jqx.position(event.args);
var cell = $("#jqxGrid").jqxGrid('getcellatposition', position.left,
position.top);
- gets cell position in grid

(18) $("#jqxGrid").jqxGrid('addrow', parseInt(newID + 1), row);
- adds new row to grid

(19) $("#jqxGrid").on("cellvaluechanged", function (event) {});
- cell value changed event

(20) $('#jqxGrid').jqxGrid('getrows').splice(1, 0, newrowdata);
- adds new row at position 1

(21) $("#jqxGrid").jqxGrid('autoresizecolumns');
- sets all column to auto resize

(22) $("#jqxGrid").jqxGrid('showcolumn', 'columnName');
- shows any column which is hidden

(23) $("#jqxGrid").jqxGrid("showcolumn", 'columnname')
- hides any column which is hidden

(24) $("#jqxGrid").jqxGrid('columns')
- fetches all column of the grid

(25) $('#jqxGrid').jqxGrid('getcolumn', 'columnname');
- gets specified column from the grid

(26) $("#jqxGrid").jqxGrid('endupdate');
- grid will have end update

(27) $('#jqxGrid').jqxGrid('getdisplayrows')
- gets display row of the grid

(28) $('#jqxGrid').on('rowselect', function (event) {});
- row select function

(29) $("#jqxGrid").on('cellendedit', function (event) {});
- cell end edit event of the grid

(30) $("#jqxGrid").jqxGrid('clearfilters');
- clears the filters of the grid

(31) $('#jqxGrid').jqxGrid('getdatainformation')
- gets data information of the grid

(32) $("#jqxGrid").jqxGrid('beginupdate');
- for the grid begin update when we want to change anything

(33) $('#jqxGrid').jqxGrid('getboundrows')
- gets bound rows in grid

(34) $('#jqxGrid').jqxGrid('selectrow', 1);
- selects row number 1 in grid

(35) $("#jqxGrid").jqxGrid('getcellvalue', row, 'columnName');
- gets cell value of any row

(36) var filtergroup = new $.jqx.filter();
var filtervalue = value to filter;
var filtercondition = 'equal';
var filter = filtergroup.createfilter('stringfilter', filtervalue, filtercondition);
- to create filter group in grid

(37) $('#jqxGrid').jqxGrid('unselectrow', rowBoundIndex);
- used to unselect selected row

(38) $("#jqxgrid").jqxGrid('showgroupsheader', false);
- To hide the grouping panel, set the 'showgroupsheader' property to false.

(39) $("#jqxgrid").jqxGrid('addgroup', 'lastname');

- The 'addgroup', 'insertgroup', 'removegroup' and 'removegroupat' functions enable groups manipulation with the Grid API. 

These API may used for some small operations we are performing for specific purpose. Some of the commands are pretty straight forward but some of them require some more information.

For more APIs Click Here