Infragistics webdatagrid - infragistics

how to write the following code into server side.that is aspx.cs page.
I am just beginner.
I wrote all the grid definitions into server side.I am trying to insert the checkbox column into infragistics webdatagrid.
<ig:WebDataGrid
ID="wdg"
runat="server"
DataKeyFields="Id" <-- change with your primary key
Width="400">
<Columns>
<ig:UnboundCheckBoxField Key="Checked" Header-Text="Select" Width="50" headerCheckBoxMode="BiState">
<Header Text="Select"></Header>
</ig:UnboundCheckBoxField>
</Columns>

You can define and add the UnboundCheckBoxField to your grid on the server-side like this:
UnboundCheckBoxField field = new UnboundCheckBoxField();
field.Key = "Checked";
field.HeaderCheckBoxMode = Infragistics.Web.UI.CheckBoxMode.BiState;
field.Width = new Unit(50);
field.Header.Text = "Select";
wdg.Columns.Add(field);

Related

SAPUI5 List CustomListItem / Rerender Issue

I got a split-app, left Hand side a master list with persons. right-hand side a Detail page with info and RatingIndicator element. Two lists on the detail-page which are bound via associations: /Master/Detail/Rating.
Whenever I use the Rating Indicator, it seems like the page is rerendering, which makes everything slow at the end. I tried both, two-way binding and one-way-binding with manually updating the model. It still rerenders/reloads the page every time I use the Rating indicator.
Any idea someone?
SAPUI5 library is on Version 1.28.31.
Edit: In the meantime I reduced complexity (no lists within lists, thought this might be the issue, but it isnt), and still the issue occurs. Even now when I use the Rating indicator the whole Detail page reloads/rerenders.
What can I do?
Before Clicking the Rating indicator:
Directly after cliking the Rating indicator, right-hand Detail page disappears and reappears withing seconds.
View:
<mvc:View controllerName="split.controller.Detail" xmlns="sap.m"
xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc" xmlns:footerbar="sap.ushell.ui.footerbar"
xmlns:f="sap.ui.layout.form" xmlns:l="sap.ui.layout">
<Page id="page" navButtonPress="onNavBack" showNavButton="{device>/system/phone}"
title="{i18n>detailTitle}" busy="{detailView>/busy}"
busyIndicatorDelay="{detailView>/delay}" class="sapUiResponsiveContentPadding">
<content>
<List items="{ path: 'WorklistToDocument' }">
<CustomListItem>
<VBox class="sapUiSmallMargin" }">
<Title titleStyle="H3" text="{Title}" }" />
<Text text="{Description}" }" />
</VBox>
<VBox class="sapUiSmallMargin">
<Text text="{Description}" />
<CheckBox selected="{NotApplicable}" select="onNACheckBoxSelect" />
<RatingIndicator value="{RatingValue}" maxValue="{MaxValue}" change="onRatingChanged" />
<Text
text="{ path: 'RatingValue', formatter: '.formatter.ratingText' }" />
</VBox>
</CustomListItem>
</List>
</content>
</Page>
Controller:
onRatingChanged: function(oEvent) {
var oSource = oEvent.getSource();
var oModel = this.getModel();
var sPath = oSource.getBindingContext().sPath;
var sCtxPath = sPath + "/RatingValue";
var sCtxPathNA = sPath + "/NotApplicable";
var iValue = oEvent.getParameter("value");
oModel.setProperty(sCtxPath, iValue);
oModel.setProperty(sCtxPathNA, false);
},
Is this line
var sCtxPath = sPath + "/RatingValue";
not leading to another "change" event trigger?
Additionally, is there a loop in your formatter that could cause a 'hang'?
And what about any events in your master with the same odata path?

cfchart displaying white spaces

I am counting response of a specific question and wants to display its response count through charts. I am using this code for counting response.
<cfquery name="questions">
SELECT
questions.id,
questions.question as question,
questiontypes.name as questiontype,
questiontypes.template as template,
surveys.name as surveysname
FROM
questions
LEFT JOIN answers ON questions.id = answers.fkquestionid
INNER JOIN questiontypes ON questions.fkquestiontypeid = questiontypes.id
INNER JOIN surveys ON questions.fksurveyid = surveys.id
WHERE fksurveyid = <cfqueryparam cfsqltype="cf_sql_integer" value="#arguments.surveyid#">
</cfquery>
<cfset response.question = questions>
<cfloop query="questions">
<cfswitch expression ="#questions.template#">
<cfcase value="truefalse">
<cfquery name="gettotaltruefalse">
SELECT COUNT( IF(result.truefalse = 1,1,NULL )) AS totaltrue,
COUNT( IF(result.truefalse = 0,0,NULL )) AS totalfalse,
COUNT( IF(result.truefalse = 1,1,NULL ))/COUNT(0)*100 AS trueperc,
COUNT( IF(result.truefalse = 0,0,NULL ))/COUNT(0)*100 AS falseperc
FROM results result
WHERE fkquestionid = <cfqueryparam cfsqltype="cf_sql_integer" value="#questions.id#">
AND NOT ISNULL(result.truefalse)
GROUP BY result.fkquestionid
</cfquery>
<cfset response.totaltruefalse = gettotaltruefalse>
</cfcase>
I am using this code to display charts.
<cfoutput query="rc.data.questions" group="id">
<cfchart format="flash" chartwidth="575" chartheight="575" show3d="yes">
<cfchartseries type="pie" paintstyle="raise" seriescolor="blue" datalabelstyle="pattern">
<cfchartdata item="true" value="#rc.data.totaltruefalse.totaltrue#">
<cfchartdata item="false" value="#rc.data.totaltruefalse.totalfalse#">
</cfchartseries>
</cfchart>
</cfoutput>
my problem is, it is showing white space instead of chart even i have tried this in all browsers.
My other answer has to do with server configuration settings based on if you have blocked access to the CFIDE directory. Another approach would be to bypass that behavior by saving the generated chart yourself (a flash file .SWF) to the web server and then displaying that file instead.
It's really easy with ColdFusion. Just add the name attribute to your <cfchart> tag. This will tell ColdFusion to store the binary chart data into the variable named with that attribute. Like this:
<cfchart format="flash" name="chartname" chartwidth="575" chartheight="575" show3d="yes">
<cfchartseries type="pie" paintstyle="raise" seriescolor="blue" datalabelstyle="pattern">
<cfchartdata item="true" value="#rc.data.totaltruefalse.totaltrue#">
<cfchartdata item="false" value="#rc.data.totaltruefalse.totalfalse#">
</cfchartseries>
</cfchart>
In that code I have named the variable chartname. Next, write the data to a file with a .SWF extension. You need to write this file to a browsable directory on your server (like an images folder or some such). Like this:
<cffile action="write" file="C:\webroot\images\mychart.swf" output="#chartname#" />
In that code I wrote the file mychart.swf to the C:\webroot\images\ folder. It can be any directory you wish as long as it is accessible under your web root. The output attribute must match the variable name given in the <cfchart> tag's name attribute and must be within #.
Next, include that SWF file in your HTML code. Like this:
<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://active.macromedia.com/flash2/cabs/swflash.cab#version=4,0,2,0"
WIDTH="575" HEIGHT="575">
<PARAM NAME="movie" VALUE="/images/mychart.swf"/>
<PARAM NAME="quality" VALUE="high"/>
<PARAM NAME="bgcolor" VALUE="#FFFFFF"/>
<EMBED src="/images/mychart.swf"
quality="high" bgcolor="#FFFFFF" WIDTH="575" HEIGHT="575" TYPE="application/x-shockwave-flash"
PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">
</EMBED>
</OBJECT>
In that code the value attribute of the <param> tag and the src attribute of the <embed> tag must match the location of the written .SWF file above (the images folder in this example).
I am guessing it has to do with setup/security on your ColdFusion server. Can you navigate to http://yourserver.com/CFIDE/GraphData.cfm (replace yourserver.com with your domain)? In order for <cfchart> to work it needs access to the CFIDE directory (NOTE - that file does not actually exist. It is merely an alias for the ColdFusion charting).
It also needs access to the CFIDE/scripts directory and the CF_RunActiveContent.js JavaScript file found there.
If you view the source of your generated page (with the blank chart) you will see something like:
<html>
<head><title>Test</title></head>
<body>
<div>
<NOSCRIPT>
<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://active.macromedia.com/flash2/cabs/swflash.cab#version=4,0,2,0"
ID="Images_5281548670100005_SWF" name="Images_5281548670100005_SWF" WIDTH="575" HEIGHT="575">
<PARAM NAME="movie" VALUE="/CFIDE/GraphData.cfm?graphCache=wc50&graphID=Images/5281548670100005.SWF"/>
<PARAM NAME="quality" VALUE="high"/>
<PARAM NAME="bgcolor" VALUE="#FFFFFF"/>
<EMBED src="/CFIDE/GraphData.cfm?graphCache=wc50&graphID=Images/5281548670100005.SWF"
quality="high" bgcolor="#FFFFFF" WIDTH="575" HEIGHT="575" TYPE="application/x-shockwave-flash"
PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">
</EMBED>
</OBJECT>
</NOSCRIPT>
<script type="text/javascript" charset='utf-8' src='/CFIDE/scripts/CF_RunActiveContent.js'></script>
<script type="text/javascript" charset='utf-8'>
CF_RunContent('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" \r\n codebase="http://active.macromedia.com/flash2/cabs/swflash.cab#version=4,0,2,0"\r\n ID="Images_5281548670100005_SWF" name="Images_5281548670100005_SWF" WIDTH="575" HEIGHT="575">\r\n\t<PARAM NAME="movie" VALUE="/CFIDE/GraphData.cfm?graphCache=wc50&graphID=Images/5281548670100005.SWF"/>\r\n\t<PARAM NAME="quality" VALUE="high"/>\r\n\t<PARAM NAME="bgcolor" VALUE="#FFFFFF"/>\r\n<EMBED src="/CFIDE/GraphData.cfm?graphCache=wc50&graphID=Images/5281548670100005.SWF" \r\n\t\tquality="high" bgcolor="#FFFFFF" WIDTH="575" HEIGHT="575" TYPE="application/x-shockwave-flash"\r\n PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">\r\n</EMBED>\r\n</OBJECT>');
</script>
</div>
</body>
</html>
Notice the references to the CFIDE directory. If that directory is not accessible the <cfchart> tag will not work correctly (you will get a blank chart).
Two relevant discussions about this with potential work arounds:
On the Adobe forums
By Brandon Purcell

Infragistics web datagrid header checkbox Event issue

ISSUE
I am new to infragistics, I am using the webdatagrid in my page. My grid has a check box as one of the fields. The header field is also a check box .
In the server side event( i need this in the server event no client side events:) ) of the header check box . I need to bind the grid .
If header check box is checked i need to display only active records and if its unchecked i need to display all records .
I am implementing this logic in the server function of the header check box and the grid is not binding( ie the values are not changed) in this event .
I am working on this fix for over a week now . Please help
Please see the code below ...........
ASPX
<ig:WebDataGrid ID="WebDataGrid1" runat="server" EnableDataViewState="true" ViewStateMode="Enabled" Height="100%" Width="100%" AutoGenerateColumns="False" OnColumnSorted="WebDataGrid1_ColumnSorted" DataKeyFields="Id">
<Columns>
<ig:BoundDataField DataFieldName="Id" Hidden="True" Key="Id">
<Header Text="BoundColumn_0" />
</ig:BoundDataField>
<ig:BoundDataField DataFieldName="Name" Key="Name">
<Header Text="Name"></Header>
</ig:BoundDataField>
<ig:BoundDataField DataFieldName="ShortName" Key="ShortName">
<Header Text="ShortName"></Header>
</ig:BoundDataField>
<ig:BoundDataField DataFieldName="IsoCode" Key="IsoCode">
<Header Text="IsoCode"></Header>
</ig:BoundDataField>
<ig:TemplateDataField Key="IsActive" Header-Text="IsActive">
<HeaderTemplate>
<asp:CheckBox ID="chkChildIsActive" runat="server" Checked="true"
Text="IsActive" AutoPostBack="True"
oncheckedchanged="chkChildIsActive_CheckedChanged">
</asp:CheckBox>
</HeaderTemplate>
<ItemTemplate>
<asp:CheckBox ID="chkHIsActive" runat="server" Checked='<%# DataBinder.Eval(((Infragistics.Web.UI.TemplateContainer)Container).DataItem, "IsActive") %>'>
</asp:CheckBox>
</ItemTemplate>
<Header Text="IsActive" />
</ig:TemplateDataField>
</Columns>
<ClientEvents Click="WebDataGrid1_SingleClick" DoubleClick="WebDataGrid1_DoubleClick" />
<Behaviors>
<ig:Paging PageSize="15" QuickPages="9">
<PagerTemplate>
<uc1:CustomerPagerControl ID="CustomerPager" runat="server" />
</PagerTemplate>
</ig:Paging>
<ig:Sorting>
</ig:Sorting>
<ig:RowSelectors>
</ig:RowSelectors>
<ig:Selection RowSelectType="Single" CellClickAction="Row" CellSelectType="None">
</ig:Selection>
</Behaviors>
</ig:WebDataGrid>
ASPX.cs
// Page load binding data to grid
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
List<Port> port = PortManager.PortListTestPaging(true);
WebDataGrid1.DataSource = port;
WebDataGrid1.DataBind();
}
}
//Checkbox Event
protected void chkChildIsActive_CheckedChanged(object sender, EventArgs e)
{
CheckBox chkChildIsActive = (CheckBox)sender;
List<Port> port = PortManager.PortListTestPaging(chkChildIsActive.Checked);
WebDataGrid1.DataSource = port;
WebDataGrid1.DataBind();
}
Fixes that i tried from the Infragistics forum:
EnableDataViewState = false : If we give this property to grid then on the checkbox event the grids all data is cleared ( and the check box event is not fired) .
EnableDataViewState = true and WebDataGrid1.ClearDataSource(): Then I had the following error occurred on check box event "Multiple controls with the same ID 'xyz0_4' were found" I have gone through the below link for a fix but failed .
http://www.infragistics.com/community/forums/p/65065/329361.aspx
WebDataGrid1.Rows.Clear() & //WebDataGrid1.Columns.Clear() : Both not worked .
I wanted to know what the issue was so itried the same code for a button event with button outside the grid and it worked . So i think its some problem with some of the properties in the webdatagrid that i may have wrongly given . I have gone through all possible work around that were available .
Thanks ,
Sankardeep V
The simplest solution is to move your logic rebinding the grid from your CheckChanged event handler to the Page_PreRender event. To do this you will need to store if the CheckChanged event was fired and what the value of the check box is in private variables to the page and then check them in the PreRender event. This should work the same as it did in a Button click for you.

Sharepoint Deploy new Column to list

I'm fairly new to SharePoint 2010, I've had some experience with 2007 but only debugging and fixing some small bug.
Assuming that i create a new solution for SP 2010 in VS2010 and i add a feature to create some list definitions and also some list instances of those list definition templates. These are all declared through Schema.xml =>
I deploy successfully and add a few items to my new lists.
Now i want to add a few extra columns (fields) to my lists, how will i deploy them?
I don't want to create them in code, i would like to have a up to date solution that with every new developer a simple deployment would create an up and running Dev environment.
What is the correct way to do the deployment in this case?
If you have the schema.xml file defined for the list, then you really want to add your new columns using the collection within the list definition. You also want to be sure your list is defined by a content type, allowing for reuse. So within your schema.xml file, it would look something like this:
<List xmlns:ows="Microsoft SharePoint" Title="Test List" FolderCreation="FALSE" Direction="$Resources:Direction;" Url="Lists/Test-List" BaseType="0" xmlns="http://schemas.microsoft.com/sharepoint/">
<MetaData>
<ContentTypes>
<ContentType ID="0x010068a2e063a1a74913a37ecdb61ab2c721" Name="Test" Group="Custom Content Types" Description="Test Description" Inherits="TRUE" Version="0">
<FieldRefs>
<FieldRef ID="{c2f80e7d-666e-4273-8b58-d5c8a13a9d6a}" Name="Col1" ShowInNewForm="TRUE" Required="TRUE" ShowInEditForm="TRUE"/>
<FieldRef ID="{a84d620a-d42d-455c-8ef8-7e9f1d443250}" Name="Col2" Required="TRUE" ShowInNewForm="TRUE" ShowInEditForm="TRUE"/>
<!-- Your new field refs here here -->
</FieldRefs>
</ContentType>
</ContentTypes>
<Fields>
<Field ID="{c2f80e7d-666e-4273-8b58-d5c8a13a9d6a}" Type="Text" AllowDeletion="FALSE" Description="Key" AllowDuplicateValues="FALSE" EnforceUniqueValues="TRUE" Indexed="TRUE" Name="Col1" DisplayName="Col1" Group="Custom Columns" />
<Field ID="{a84d620a-d42d-455c-8ef8-7e9f1d443250}" Type="Text" AllowDeletion="FALSE" Name="Col2" DisplayName="Col2" Group="Custom Columns" />
<!-- Your new fields here -->
</Fields>
...
</MetaData>
</List>
Don't forget to change your View as well!

How to show custom message when somebody clicks on refresh button of Coldfusion cfGrid (When session is out)?

I am using Coldfusion (9.0.1) cfGrid to populate some data. Code is given below
<cfform id="ViewNewCustomerReport" name="ViewNewCustomerReport">
<div class="buttonClass">
<cfinput type="button" id="generateReport" name="generateReport"
value="Generate Report" />
<cfinput type="hidden" name="filters" id="filters"
bind="javascript:GenerateReport({generateReport#click})"/>
</div>
<br/>
<div id="gridContainer">
<cfgrid name="NewCustomerReport" autoWidth="Yes" colheaderbold="true" selectonload="false" width="710"
bind="url:index.cfm?fuseaction=ReportsCommon.GetNewCustomerReport&page={cfgridpage}&pagesize={cfgridpagesize}&gridsortcolumn={cfgridsortcolumn}&gridsortDirection={cfgridsortdirection}&filter={filters}"
bindOnLoad="false" striperows="true" striperowcolor="##F6F6F6" format="html" pagesize="10">
<cfgridcolumn name="COMPANY_NAME" width="280" header="Company Name" />
<cfgridcolumn name="SUBJECT_ASSIGNED" width="280" header="Subject Assigned" />
<cfgridcolumn name="NO_OF_USERS" header="No. Of users" width="180" />
</cfgrid>
</div>
<div id="wrapperDiv"><label id="lblError" class="CustomError"></label></div>
</cfform>
And this is the javascript part
var GenerateReport = function(filters){
var returnVal;
var checkForm = $('#ViewNewCustomerReport').validationEngine('validate');
returnVal = dateFrom + '|' + dateTo;
if(checkForm)
{
var gridObject = ColdFusion.Grid.getGridObject("NewCustomerReport");
var store = gridObject.getStore();
store.addListener("load",function(){
if(store.data.items == 0)
{
gridObject.setVisible(false);
$("#gridContainer").hide();
$("#wrapperDiv").show();
$("#wrapperDiv").css("text-align","center");
$("#lblError").text("No record found").css({"font-size":"20px","font-weight":"normal"});
}
else
{
gridObject.setVisible(true);
$("#gridContainer").show();
$("#wrapperDiv").hide();
}
});
}
else
{
$('#gridContainer').hide();
}
return returnVal;
};
Now if somebody logout the application in another tab and then refreshes the Grid it show some message like
CFGRID: TOTALROWCOUNT missing from response data [Enable debugging by adding 'cfdebug' to your URL parameters to see more information]
When Session is out in return the Json data collected is like that
{"isSessionOut":true} HTTP Status code 200 HTTP status Message OK
So my Question is instead of showing that default error message i want to show my custom message like session is out please log in to continue.
how can these be achieved ?? Thanks in advance ......
Every bind operation/Ajax call in coldfusion has an OnError/BindError handler function, which can be called at the time of some error, or we can call it with the help of HTTP response by setting the HTTP status code.
Whenever you want some
self generated error message, you can write this code at response/Action page of your site:
error = getpagecontext().getresponse().setstatus(306, "Your session is out");
(you can set HTTP status code any thing more then 300 but i have checked only for 306 and it works)
by this you can call onError function of your CFGRID
I would use a jQuery or similar plugin that runs in the outer page and detects inactivity, then it can even count down when session is timing out and gracefully take your user back to a login page. This way you wont have this issue on any page.
This one is good, there are many others also
jsFiddle