Using a Kendo grid with AJAX.
The default filter of the initial grid load is defined as:
var ds = $("#history-grid").data("kendoGrid").dataSource;
if ($("#history-search").val().trim().length == 0) {
if (!user) { user = $("#username").text().trim(); }
ds.filter({
field: "RequestOwner"
, operator: "equals"
, value: user
})
}
The above worked great, grid would be filtered according to RequestOwner, and the checkbox for the specific user in the RequestOwner column's filter dropdown would be marked as checked when the grid was first loaded.
Then I added filterMenuInit to the grid initialization, which did sort the filter items appropriately, but removed the check from the checkbox for the specific user in the RequestOwner column's filter dropdown (On initial grid load). The filter itself is correctly applied to the grid, I just cannot get the checkbox for that value to show as checked (On initial grid load).
How I am defining filterMenuInit :
, filterable: true
, , filterMenuInit: function (e) {
if (e.field === "RequestOwner") {
var filterMultiCheck = this.thead.find("[data-field=" + e.field + "]").data("kendoFilterMultiCheck")
filterMultiCheck.container.empty();
filterMultiCheck.checkSource.sort({ field: e.field, dir: "asc" });
filterMultiCheck.checkSource.data(filterMultiCheck.checkSource.view().toJSON());
filterMultiCheck.createCheckBoxes();
}
}
Please advise.
I spent way too much time trying to figure out why the RadAjaxLoadingPanel was not showing. The culprit was having the RadScriptManager declared after the RadAjaxManager. Placing the script manager first makes sense, but I was pouring over the AJAX manager and loading panel code for quite some time before looking farther afield.
Hopes this helps someone!
Hi everybody! First and foremost, I am very new to software development, so I have a lot to learn. I've inherited a few projects that need some changes/updates, and the original developer is no longer here nor is there any documentation.
My first small fix is to update a checkbox to a dropdown with 3 values. The RadDropDownList updates one other dropdown on the page (as did the checkbox it's replacing), and the initial RDDL selection is handled on ItemDataBound (I have that part working!). I can't get the RDDL to update the other dropdown, and I'm fairly certain it's because I'm not using it entirely correctly. I've been through the documentation, but there's still so much that I don't know that it's proving difficult. The SelectWOStatus sub below was copypasta'd directly from the ItemCommand/CommandName case that handled the checkbox. Can anyone at least point me in the right direction?
TL;DR:
<
telerik:GridTemplateColumn
HeaderText
=
"Completed (DD)"
ItemStyle-HorizontalAlign
=
"Center"
>
<
ItemTemplate
>
<
telerik:RadDropDownList
runat
=
"server"
ID
=
"ddlStatusWO"
OnItemSelected
=
"SelectWOStatus"
AutoPostBack
=
"true"
>
<
Items
>
<
telerik:DropDownListItem
runat
=
"server"
Text
=
"Open"
Value
=
"O"
/>
<
telerik:DropDownListItem
runat
=
"server"
Text
=
"Completed"
Value
=
"F"
/>
<
telerik:DropDownListItem
runat
=
"server"
Text
=
"Return Pending"
Value
=
"H"
/>
</
Items
>
</
telerik:RadDropDownList
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<telerik:GridTemplateColumn HeaderText=
"Completed (DD)"
ItemStyle-HorizontalAlign=
"Center"
>
<ItemTemplate>
<telerik:RadDropDownList runat=
"server"
ID=
"ddlStatusWO"
OnItemSelected=
"SelectWOStatus"
AutoPostBack=
"true"
>
<Items>
<telerik:DropDownListItem runat=
"server"
Text=
"Open"
Value=
"O"
/>
<telerik:DropDownListItem runat=
"server"
Text=
"Completed"
Value=
"F"
/>
<telerik:DropDownListItem runat=
"server"
Text=
"Return Pending"
Value=
"H"
/>
</Items>
</telerik:RadDropDownList>
</ItemTemplate>
</telerik:GridTemplateColumn>
Protected
Sub
SelectWOStatus(sender
As
Object
, e
As
DropDownListEventArgs)
Dim
myJob
As
BidJob =
CType
(Session(
"Job"
& hfPageGUID.Value), BidJob)
Dim
intWONum
As
Integer
= myJob.NumberOfWorkOrders()
Dim
intCompletedCount
As
Integer
= 0
For
Each
item
As
GridDataItem
In
rgWoList.Items
Dim
ddlStatusWOSelectedValue
As
String
=
CType
(item.FindControl(
"ddlStatusWO"
), RadDropDownList).SelectedValue
'Dim ddlStatusWOSelectedValue As String = e.Value
If
ddlStatusWOSelectedValue =
"F"
Or
ddlStatusWOSelectedValue =
"H"
Then
If
intWONum = 1
Then
ddlBidStatus.SelectedValue =
"COMPLETED"
Else
ddlBidStatus.SelectedValue =
"PARTIALLY COMPLETE"
End
If
End
If
Next
If
intCompletedCount = 0
Then
ddlBidStatus.SelectedValue =
"AWARDED"
End
If
If
intCompletedCount = intWONum
Then
ddlBidStatus.SelectedValue =
"COMPLETED"
End
If
End
Sub
asdf
I am testing the ajax controls for a possible migration and I have a couple of doubts about the radgrid and raddosck
We are developing a dashboard screen that displays a differents panels. Some of the panels display charts and graphs, while others contain tables with aggregated data.
There is a lot of information being displayed on this page.
We want delay loads for each panels instead of waiting until all of the data for all of the panels has been processed before serving the page.
We´re using SqlDataSource to provide all the data, not webservice.
Now we use GridView a litle trick http://mattberseth.com/blog/2007/07/delay_load_an_updatepanel.html
Can we do this with radgrid and raddosck?
Thanks in advance
///below function call when grid go to edit mode to view mode and below code for set from list box value to grid cell value.
function GetEditorValue(sender, args) {
debugger;
if
($(args.get_cell()).find(
".RadListBox"
).length > 0) {
var lb = $find($(args.get_cell()).find(
".RadListBox"
).attr(
"id"
));
var item = lb.get_selectedItem();
if
(item !=
null
) {
args.set_cancel(
true
);
args.set_value(item.get_text());
var cell = args.get_cell();
cell.setAttribute(
"searchboxresult"
, item.get_value());
//args.set_value(item.get_value());
}
else
{
args.set_cancel(
true
);
args.set_value(
""
);
}
}
}
Here I have set attribute value of searchboxresult to specific value which you can see here:
<
td
searchboxresult
=
"109"
style
=
"width:200px;"
class
=
"rgSelectedCell rgBatchChanged"
>
<
div
style
=
""
>Headlights - Dual-Beam</
div
>
</
td
>
Now When I try to access this attribute at my server side on BatchEditCommand like this:
protected
void
accoADEGrid_BatchEditCommand(
object
sender, GridBatchEditingEventArgs e)
{
foreach
(GridBatchEditingCommand command
in
e.Commands)
{
var i = command.item.cell[9].Attribute[
"searchboxresult"
].ToString();
}
}
I am getting value of i = 0; which is not as per client value and getting unchange value of attribute which is set on ItemDataBound.
I have an issue where I have a popup window (windowmanager has height/width that are explicit, is a modal).
This popup contains a html table. One tr is 20% wide, other is 80%.
I have a grid in the 20% wide side (left side) and in IE and Chrome it is fine, but in firefox, the .rgDataDiv class is injecting a height of 10px. In IE and Chrome, the value gets calculated fine.
No ajax. Any ideas?
Changing AllowScroll="true" to "false" fixes the issue but I want the autoscroll to be true.
<
table
style
=
"width: 100%; height: 88vh; border-spacing: 0; border-collapse: collapse; border: 0"
>
<
tr
>
<
td
width
=
"20%"
>
<
RadGrid
ID
=
"PayrollProcessSummaryGrid"
runat
=
"server"
GridLines
=
"None"
Height
=
"100%"
AutoAssignModifyProperties
=
"true"
>
<
ClientSettings
AllowColumnsReorder
=
"false"
ReorderColumnsOnClient
=
"false"
>
<
Scrolling
AllowScroll
=
"true"
UseStaticHeaders
=
"true"
/>
<
Selecting
AllowRowSelect
=
"true"
/>
<
ClientEvents
OnRowClick
=
"onRowClick"
OnGridCreated
=
"onGridCreated"
OnCommand
=
"onCommand"
/>
</
ClientSettings
>
<
MasterTableView
AutoGenerateColumns
=
"false"
CommandItemDisplay
=
"Top"
AllowSorting
=
"false"
>
<
CommandItemTemplate
></
CommandItemTemplate
>
<
Columns
>
<
wasp:GridDateTimeControl
DataField
=
"field1"
LabelText
=
"*field1*"
SortExpression
=
"field1"
niqueName
=
"field1"
/>
<
wasp:GridDateTimeControl
DataField
=
"field2"
LabelText
=
"*field2*"
SortExpression
=
"field2"
niqueName
=
"field2"
/>
</
Columns
>
</
MasterTableView
>
</
RadGrid
>
</
td
>
<
td
width
=
"80%"
>
<
telerik:RadSplitter
ID
=
"RadSplitter"
runat
=
"server"
Orientation
=
"Horizontal"
Height
=
"100%"
Width
=
"100%"
VisibleDuringInit
=
"false"
OnClientLoad
=
"onClientLoad"
BorderSize
=
"0"
>
<
telerik:RadPane
ID
=
"RadPane"
runat
=
"server"
Width
=
"100%"
/>
</
telerik:RadSplitter
>
</
td
>
</
tr
>
</
table
>
<
telerik:RadComboBox
AutoPostBack
=
"true"
ID
=
"txtGelPackProdCode"
runat
=
"server"
EnableLoadOnDemand
=
"true"
ShowMoreResultsBox
=
"true"
EnableVirtualScrolling
=
"true"
EmptyMessage
=
"Enter here..."
onselectedindexchanged
=
"txtGelPackProdCode_SelectedIndexChanged"
>
<
WebServiceSettings
Path
=
"MasterFormulaWebService.svc"
Method
=
"LoadProductData"
/>
</
telerik:RadComboBox
>
public RadComboBoxData LoadProductData(RadComboBoxContext context)
{
string text = context.Text.Trim() + '%';
DataTable data = ProductDAO.ViewData2(text, "RadCombo");
List<
RadComboBoxItemData
> result = new List<
RadComboBoxItemData
>(context.NumberOfItems);
RadComboBoxData comboData = new RadComboBoxData();
try
{
int itemsPerRequest = 10;
int itemOffset = context.NumberOfItems;
int endOffset = itemOffset + itemsPerRequest;
if (endOffset > data.Rows.Count)
{
endOffset = data.Rows.Count;
}
if (endOffset == data.Rows.Count)
{
comboData.EndOfItems = true;
}
else
{
comboData.EndOfItems = false;
}
result = new List<
RadComboBoxItemData
>(endOffset - itemOffset);
for (int i = itemOffset; i <
endOffset
; i++)
{
RadComboBoxItemData
itemData
=
new
RadComboBoxItemData();
itemData.Text
=
data
.Rows[i]["prod_code"].ToString().Trim();
itemData.Value
=
data
.Rows[i]["name"].ToString().Trim();
result.Add(itemData);
}
if (data.Rows.Count > 0)
{
comboData.Message = String.Format("Items <
b
>1</
b
>-<
b
>{0}</
b
> out of <
b
>{1}</
b
>", endOffset.ToString(), data.Rows.Count.ToString());
}
else
{
comboData.Message = "No matches";
}
}
catch (Exception e)
{
comboData.Message = e.Message;
}
comboData.Items = result.ToArray();
return comboData;
}
<
system.serviceModel
>
<
behaviors
>
<
endpointBehaviors
>
<
behavior
name
=
"Reena.Master.MasterFormulaWebServiceAspNetAjaxBehavior"
>
<
enableWebScript
/>
</
behavior
>
</
endpointBehaviors
>
</
behaviors
>
<
serviceHostingEnvironment
aspNetCompatibilityEnabled
=
"true"
multipleSiteBindingsEnabled
=
"true"
/>
<
services
>
<
service
name
=
"Reena.Master.MasterFormulaWebService"
>
<
endpoint
address
=
""
behaviorConfiguration
=
"Reena.Master.MasterFormulaWebServiceAspNetAjaxBehavior"
binding
=
"webHttpBinding"
contract
=
"Reena.Master.MasterFormulaWebService"
/>
</
service
>
</
services
>
<
bindings
>
<
webHttpBinding
>
<
binding
name
=
"webBinding"
>
<
security
mode
=
"None"
>
</
security
>
</
binding
>
</
webHttpBinding
>
</
bindings
>
</
system.serviceModel
>