I have a grid panel which display two TimeSpans in two columns and all is well when I load the page but when I go server side the validation on my editors always fail. I don't understand why the store can display the TimeSpans but cannot return it after...
Here my code :
<ext:GridPanel ID="WeekParams" runat="server" >
<Store>
<ext:Store runat="server">
<Reader>
<ext:JsonReader IDProperty="GUID">
<Fields>
<ext:RecordField Name="Day" Type="String" />
<ext:RecordField Name="UATNumber" Type="int" />
<ext:RecordField Name="From" Type="Date" />
<ext:RecordField Name="To" Type="Date" />
</Fields>
</ext:JsonReader>
</Reader>
</ext:Store>
</Store>
<ColumnModel>
<Columns>
<ext:Column ColumnID="Day" DataIndex="Day" />
<ext:NumberColumn ColumnID="UATNumber" DataIndex="UATNumber" Format="0" />
<ext:DateColumn ColumnID="From" DataIndex="From" Format="dd/MM/yyyy" >
<Renderer Format="Date" FormatArgs="'HH:mm'" />
<Editor>
<ext:TimeField runat="server" />
</Editor>
</ext:DateColumn>
<ext:DateColumn ColumnID="To" DataIndex="To" Format="dd/MM/yyyy" >
<Renderer Format="Date" FormatArgs="'HH:mm'" />
<Editor>
<ext:TimeField runat="server" />
</Editor>
</ext:DateColumn>
</Columns>
</ColumnModel>
<Plugins>
<ext:EditableGrid runat="server" />
</Plugins>
</ext:GridPanel>
And here the result when I'm going to the server side :
Related
I have a PXSmartPanel on the Sales Orders form (SO301000) in Acumatica ERP (v21.109.0018). In the PXSmartPanel I have a PXTab with two PXTabItem's. Each tab item has a PXGrid in it.
Whenever the smart panel opens, the grid in the first tab item shows with the correct data. But when I select the other tab item, the grid doesn't show at all (no data, no column names, no toolbar actions). I'm not sure if there's an attribute that I'm missing, but any help would be appreciated.
Here is my ASPX code for the PXSmartPanel. The grid with the ID "GridKitNonStkComponents" is the one that isn't showing:
<px:PXSmartPanel runat="server" ID="KitComponentsPanel" DesignView="Content" AllowResize="true"
AcceptButtonID="KitComponentSaveButton" CancelButtonID="KitComponentCancelButton" LoadOnDemand="true"
CaptionVisible="true" Caption="Kit Component Items" Key="KitComponentsPanel"
AutoRepaint="true" style="position:static;" Height="400px" Width="560px">
<px:PXTab ID="kitCompTab" runat="server" Width="100%" Height="85%">
<Items>
<px:PXTabItem Text="Stock Components">
<Template>
<px:PXGrid runat="server" ID="GridKitStkComponents" Height="100%" Width="100%" SyncPosition="true">
<Levels>
<px:PXGridLevel DataMember="KitStkComponents">
<Columns>
<px:PXGridColumn DataField="CompInventoryID" Width="70" CommitChanges="True" />
<px:PXGridColumn DataField="CompDescription" Width="280" />
<px:PXGridColumn DataField="ComponentQty" />
</Columns>
</px:PXGridLevel>
</Levels>
<ActionBar Position="Top">
<Actions>
<AddNew MenuVisible="True" />
<Save MenuVisible="False" Enabled="False" />
<Search MenuVisible="False" Enabled="False" />
<NoteShow Enabled="False" MenuVisible="False" />
<Refresh MenuVisible="True" />
<Delete MenuVisible="True" />
<AdjustColumns MenuVisible="True" />
<ExportExcel MenuVisible="True" />
</Actions>
<CustomItems>
<px:PXToolBarButton>
<AutoCallBack Command="ResetStkCompsToDefault" Target="ds">
<Behavior CommitChanges="true" />
</AutoCallBack>
</px:PXToolBarButton>
</CustomItems>
</ActionBar>
<AutoSize Enabled="true" />
</px:PXGrid>
</Template>
</px:PXTabItem>
<px:PXTabItem Text="Non-Stock Components" LoadOnDemand="true">
<Template>
<px:PXGrid runat="server" ID="GridKitNonStkComponents" Height="100%" Width="100%" SyncPosition="true">
<Levels>
<px:PXGridLevel DataMember="KitNonStkComponents">
<Columns>
<px:PXGridColumn DataField="CompInventoryID" Width="70" CommitChanges="True" />
<px:PXGridColumn DataField="CompDescription" Width="280" />
<px:PXGridColumn DataField="ComponentQty" />
</Columns>
</px:PXGridLevel>
</Levels>
<ActionBar Position="Top">
<Actions>
<AddNew MenuVisible="True" />
<Save MenuVisible="False" Enabled="False" />
<Search MenuVisible="False" Enabled="False" />
<NoteShow Enabled="False" MenuVisible="False" />
<Refresh MenuVisible="True" />
<Delete MenuVisible="True" />
<AdjustColumns MenuVisible="True" />
<ExportExcel MenuVisible="True" />
</Actions>
<CustomItems>
<px:PXToolBarButton>
<AutoCallBack Command="ResetNonStkCompsToDefault" Target="ds">
<Behavior CommitChanges="true" />
</AutoCallBack>
</px:PXToolBarButton>
</CustomItems>
</ActionBar>
<AutoSize Enabled="true" />
</px:PXGrid>
</Template>
</px:PXTabItem>
</Items>
</px:PXTab>
<px:PXPanel ID="KitComponentButtonPanel" runat="server" SkinID="Buttons">
<px:PXButton ID="KitComponentSaveButton" runat="server" DialogResult="OK" Text="Save" />
<px:PXButton ID="KitComponentCancelButton" runat="server" DialogResult="Cancel" Text="Cancel" />
</px:PXPanel>
</px:PXSmartPanel>
Here is the code for my graph extension (at the moment, the EditKitComponents action just opens the smart panel):
public class SOOrderEntry_Extension : PXGraphExtension<SOOrderEntry>
{
public static bool IsActive() => true;
#region Selects / Views
public SelectFrom<SOLineKitComponent>.
Where<SOLineKitComponent.soOrderType.IsEqual<SOLine.orderType.FromCurrent>.
And<SOLineKitComponent.soOrderNbr.IsEqual<SOLine.orderNbr.FromCurrent>>.
And<SOLineKitComponent.soLineNbr.IsEqual<SOLine.lineNbr.FromCurrent>>.
And<SOLineKitComponent.kitInventoryID.IsEqual<SOLine.inventoryID.FromCurrent>>.
And<SOLineKitComponent.stkItem.IsEqual<True>>>.View KitStkComponents;
public SelectFrom<SOLineKitComponent>.
Where<SOLineKitComponent.soOrderType.IsEqual<SOLine.orderType.FromCurrent>.
And<SOLineKitComponent.soOrderNbr.IsEqual<SOLine.orderNbr.FromCurrent>>.
And<SOLineKitComponent.soLineNbr.IsEqual<SOLine.lineNbr.FromCurrent>>.
And<SOLineKitComponent.kitInventoryID.IsEqual<SOLine.inventoryID.FromCurrent>>.
And<SOLineKitComponent.stkItem.IsEqual<False>>>.View KitNonStkComponents;
public SelectFrom<SOOrder>.View KitComponentsPanel;
#endregion
#region Actions
public PXAction<SOOrder> EditKitComponents;
[PXButton]
[PXUIField(DisplayName = "Edit Kit Components")]
public virtual void editKitComponents()
{
if(KitComponentsPanel.AskExt() == WebDialogResult.OK)
{
}
}
#endregion
}
Here is what the smart panel looks like when the different tab items are selected:
Tab Item with Grid Showing
Tab Item with Grid Not Showing
You need to set the "LoadOnDemand" to false for the whole PXSmartPanel to have the second tab working.
<px:PXSmartPanel runat="server" ID="KitComponentsPanel"
...
LoadOnDemand="False"
...
>
I would also consider setting LoadOnDemand to false for the second tab.
<px:PXTabItem Text="Non-Stock Components" LoadOnDemand="false">
Using Ext.NET combobox.
<ext:ComboBox runat="server"
ID="ComboBoxCategorizedList"
QueryMode="Local"
ValueField="Id"
EmptyText="Type to begin search..."
TypeAhead="false"
DisplayField="Name"
Width="500"
NoteAlign="Down" EnableKeyEvents="true"
Note="Press 'Search' icon or Press ENTER for more results"
RemoveClearTrigger="true">
<%--Note="Type '*' for a full list"--%>
<HtmlBin>
<ext:XScript runat="server">
<script type="text/javascript">
$(window).on("__refresh__", function () {
#{ StoreComboBoxCategorizedList }.reload();
});
</script>
</ext:XScript>
</HtmlBin>
<Store>
<ext:Store runat="server" ID="StoreComboBoxCategorizedList" OnReadData="ComboBoxCategorizedList_ReadData">
<Proxy>
<ext:PageProxy />
</Proxy>
<Model>
<ext:Model Id="ModelCategorizedComboBox" runat="server" IDProperty="Id">
<Fields>
<ext:ModelField Name="Id" />
<ext:ModelField Name="Name" />
<ext:ModelField Name="Type" />
<ext:ModelField Name="RefId" />
<ext:ModelField Name="Description" />
</Fields>
</ext:Model>
</Model>
<Listeners>
<Update Handler="#{ComboBoxCategorizedList}.expand();" />
<EndUpdate Handler="categorizedList();" />
</Listeners>
<Parameters>
<ext:StoreParameter Mode="Raw" Name="filter" Value="#{ComboBoxCategorizedList}.getValue()" />
</Parameters>
</ext:Store>
</Store>
<Triggers>
<ext:FieldTrigger Icon="Clear"/>
<ext:FieldTrigger Icon="Search"></ext:FieldTrigger>
</Triggers>
<Listeners>
<SpecialKey Fn="enterKeyPressHandler" />
<Expand Handler="categorizedList();" Delay="100" />
<BeforeSelect Fn="onBeforeSelect" />
<KeyPress Handler="#{ComboBoxCategorizedList}.getTrigger(1).onClick();" Buffer="1000" />
<Change Handler="filterComboxBoxFunction(#{StoreComboBoxCategorizedList}, #{ComboBoxCategorizedList}.getValue()); #{ComboBoxCategorizedList}.expand(); categorizedList();" Delay="100" />
</Listeners>
Not asking for debugging help, but I want to know if an Ext.NET or Extjs dev has a generic solution: Very simply ... I want to initiate a remote search only when the local search returns no records. So I am looking for the best way to wire this up to the combobox. I've looked at using the Expand event and BeforeQuery event but this seems to come up short.
I'm looking for best practices so i can add a "OnLocalQuery" event to my comboboxes; and then take action if the local query returns 0 matches.
I use this function and it works fine .. and without QueryMode="Local":
<ext:ComboBox ID="cmb_name" runat="server" FieldLabel="ComboBox" EmptyText="-Select-" HideTrigger="true" TriggerAction="All" SelectOnFocus="true" DisplayField="Name" ValueField="Id" Editable="true" TabIndex="11">
<Store>
<ext:Store ID="str_ComboBox" runat="server" PageSize="10">
<Model>
<ext:Model ID="mdl_ComboBox" runat="server">
<Fields>
<ext:ModelField Name="Id" />
<ext:ModelField Name="Name" />
<ext:ModelField Name="Type" />
<ext:ModelField Name="RefId" />
<ext:ModelField Name="Description" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<Listeners>
<Change Fn="fn_filter" />
</Listeners>
</ext:ComboBox>
<script type="text/javascript">
var fn_filter = function (_this, newValue, oldValue, eOpts) {
var n = 0;
if (_this.lastQuery == undefined || _this.lastQuery == null) {
_this.lastQuery = "";
}
_this.getStore().clearFilter(true);
_this.getStore().load();
_this.store.filter(function (item) {
if (item.get('Name').includes(_this.getRawValue())) {
n = n + 1;
return true;
}
else {
return false;
}
});
_this.expand();
if (n == 0) {
//returns no records
//enter code here Callback
}
}
</script>
I have created a Clinic module within Kentico V12 with two classes: Doctor and Appointment. There is a 1 to many relationship between Doctor and Appointment. How could I display the name and surname of the doctors in the Appointment grid?
<?xml version="1.0" encoding="utf-8" ?>
<grid>
<actions>
<action name="edit" caption="$General.Edit$" fonticonclass="icon-edit" fonticonstyle="allow" />
<action name="#delete" caption="$General.Delete$" fonticonclass="icon-bin" fonticonstyle="critical" confirmation="$General.ConfirmDelete$" />
</actions>
<columns>
<column source="AppointmentPatientFirstName" caption="First name" wrap="false" localize="true">
<filter type="text" size="200" />
</column>
<column source="AppointmentPatientLastName" caption="Last name" wrap="false" localize="true">
<filter type="text" size="200" />
</column>
<column source="AppointmentPatientEmail" caption="Email" wrap="false" localize="true">
<filter type="text" size="200" />
</column>
<column source="AppointmentPatientPhoneNumber" caption="Phone Number" wrap="false" localize="true">
<filter type="text" size="15" />
</column>
<column source="Date" caption="Date" wrap="false" localize="true">
<filter type="text" size="200" />
</column>
<column source="AppointmentPatientBirthDate" caption="BirthDate" wrap="false" localize="true">
<filter type="text" size="200" />
</column>
<column source="AppointmentDoctorID" caption="Doctor ID" wrap="false" localize="true">
<filter type="text" size="200" />
</column>
</columns>
<options>
<key name="DisplayFilter" value="true" />
</options>
</grid>
Kind regards.
Appointment List: https://i.stack.imgur.com/Ft1pE.png
Using this column AppointmentDoctorID modify the XML to use a transformation like so:
<column source="AppointmentDoctorID" caption="Doctor" externalsourcename="#transform: yournamespace.doctor: {%FirstName%} {%LastName%}" wrap="false" localize="true"></column>
Check out more documentation on unigrids in the Kentico Documentation.
How To Add menu when rightclick on dynamic grid in ext.net ?
I Had Tried As Below In RowExpander, It is Showing That ItemContextMenu does not support in RowExpander, Please Help me ?
<ext:RowExpander runat="server">
<Loader runat="server" DirectMethod="#{DirectMethods}.GetGrid" Mode="Component">
<LoadMask ShowMask="true" />
<Params>
<ext:Parameter Name="RecordId" Value="this.record.getId()" Mode="Raw" />
</Params>
</Loader>
<DirectEvents>
<BeforeExpand OnEvent="BeforeExpand" Success="setRaw(response, result, el, type, action, extraParams);" Before="return !record.cached;">
<EventMask ShowMask="true" Target="CustomTarget" CustomTarget="={gridRecords.body}" />
<ExtraParams>
<%--<ext:Parameter Name="company" Value="record.data['company']" Mode="Raw" />
<ext:Parameter Name="id" Value="record.id" Mode="Raw" />
<ext:Parameter Name="index" Value="rowIndex" Mode="Raw" /> --%>
<ext:Parameter Name="RecordId" Value="record.get('RecordId')" Mode="Raw" />
</ExtraParams>
</BeforeExpand>
</DirectEvents>
<Listeners>
<ItemContextMenu Handler="e.preventDefault(); #{mnuView}.showAt(e.getXY());" />
</Listeners>
</ext:RowExpander>
RowExpander doesn't have an ItemContextMenu event. You should define it for a child GridPanel itself.
It is being discussed in greater details in these forum threads:
Forum thread #1
Forum thread #2
I'm gonna create an Ext.Net's TreeGrid with custom nodes.
e.g :
All of TreeGrid's nodes should have a textbox at the front of itself and users should write a number at it.
See the below image :
Also, I have to get each nodes' textbox values in code behind at postback.
Could you please guide me, how I can create it with Ext.net and C# ?
Thanks.
Unfortunately, implementing these features with the current release of <ext:TreeGrid> in Ext.NET (v1.x) is annoyingly difficult. The <ext:TreeGrid> is just not setup for this type of rendering.
There's help coming in the next Ext.NET release (v2), although at this point it has not been released.
Here's a basic sample to help get you started with rendering the <input> fields.
Example
<%# Page Language="C#" %>
<%# Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>TreeGrid - Ext.NET Examples</title>
<link href="../../../../resources/css/examples.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
var formatHours = function (v) {
if (v || v === 0) {
return "Number : <input class=\"x-form-text x-form-field\" type=\"text\" value=\"" + v + "\" />";
}
return "";
};
</script>
</head>
<body>
<form runat="server">
<ext:ResourceManager runat="server" />
<ext:TreeGrid
ID="TreeGrid1"
runat="server"
Title="Projects"
Width="500"
Height="300"
NoLeafIcon="true"
EnableDD="true">
<Columns>
<ext:TreeGridColumn Header="Task" Width="230" DataIndex="task" />
<ext:TreeGridColumn Header="Score" Width="200" DataIndex="duration" Align="Center" SortType="AsFloat">
<XTemplate runat="server">
<Html>
{duration:this.formatHours}
</Html>
<Functions>
<ext:JFunction Name="formatHours" Fn="formatHours" />
</Functions>
</XTemplate>
</ext:TreeGridColumn>
</Columns>
<Root>
<ext:TreeNode Text="Tasks">
<Nodes>
<ext:TreeNode Icon="Folder" Expanded="true">
<CustomAttributes>
<ext:ConfigItem Name="task" Value="Project: Shopping" Mode="Value" />
</CustomAttributes>
<Nodes>
<ext:TreeNode Icon="Folder" Expanded="true">
<CustomAttributes>
<ext:ConfigItem Name="task" Value="Remodeling" Mode="Value" />
</CustomAttributes>
<Nodes>
<ext:TreeNode Icon="Folder">
<CustomAttributes>
<ext:ConfigItem Name="task" Value="Paint bedroom" Mode="Value" />
</CustomAttributes>
<Nodes>
<ext:TreeNode Leaf="true">
<CustomAttributes>
<ext:ConfigItem Name="task" Value="Ceiling" Mode="Value" />
<ext:ConfigItem Name="duration" Value="1.25" />
</CustomAttributes>
</ext:TreeNode>
<ext:TreeNode Leaf="true">
<CustomAttributes>
<ext:ConfigItem Name="task" Value="Walls" Mode="Value" />
<ext:ConfigItem Name="duration" Value="1.5" />
</CustomAttributes>
</ext:TreeNode>
</Nodes>
</ext:TreeNode>
<ext:TreeNode Leaf="true">
<CustomAttributes>
<ext:ConfigItem Name="task" Value="Decorate living room" Mode="Value" />
<ext:ConfigItem Name="duration" Value="12" />
</CustomAttributes>
</ext:TreeNode>
<ext:TreeNode Leaf="true">
<CustomAttributes>
<ext:ConfigItem Name="task" Value="Fix lights" Mode="Value" />
<ext:ConfigItem Name="duration" Value="0" />
</CustomAttributes>
</ext:TreeNode>
<ext:TreeNode Leaf="true">
<CustomAttributes>
<ext:ConfigItem Name="task" Value="Reattach screen door" Mode="Value" />
<ext:ConfigItem Name="duration" Value="142" />
</CustomAttributes>
</ext:TreeNode>
<ext:TreeNode Leaf="true">
<CustomAttributes>
<ext:ConfigItem Name="task" Value="Retile kitchen" Mode="Value" />
<ext:ConfigItem Name="duration" Value="96" />
</CustomAttributes>
</ext:TreeNode>
</Nodes>
</ext:TreeNode>
</Nodes>
</ext:TreeNode>
</Nodes>
</ext:TreeNode>
</Root>
</ext:TreeGrid>
</form>
</body>
</html>
I could found the answer :
<ext:TreeGrid ID="KnowledgeFieldsTreeGridWithTextBox1" runat="server" Title="Fileds "
Icon="Plugin" Height="300" AutoHeight="true" AutoExpandColumn="KnowledgeFiled">
<TopBar>
<ext:Toolbar ID="KnowledgeFieldsTreeGridWithTextBoxToolbar1" runat="server">
<Items>
<ext:ToolbarFill ID="KnowledgeFieldsTreeGridWithTextBoxToolbarFill1" runat="server" />
<ext:ToolbarTextItem ID="KnowledgeFieldsTreeGridWithTextBoxTextItem1" runat="server"
Text=" Filter : " />
<ext:TriggerField ID="KnowledgeFieldsTreeGridWithTextBox_TriggerField1" runat="server" EnableKeyEvents="true">
<Triggers>
<ext:FieldTrigger Icon="Clear" />
</Triggers>
<Listeners>
<KeyUp Fn="KnowledgeFieldsTreeGridWithTextBox_KeyUp" Buffer="250" />
<TriggerClick Fn="KnowledgeFieldsTreeGridWithTextBox_ClearFilter" />
</Listeners>
</ext:TriggerField>
</Items>
</ext:Toolbar>
</TopBar>
<Columns>
<ext:TreeGridColumn Header="Filed Name" DataIndex="KnowledgeFiledName" Width="100" Align="Center" />
<ext:TreeGridColumn Header="Score" DataIndex="KnowledgeScore" Width="200" Align="Right">
<XTemplate runat="server">
<Html>
<tpl if="values.leaf">
<input type="text" style="width:30px; text-align:left;" maxlength="5" value="{KnowledgeFiledScore}"></input>
</tpl>
</Html>
</XTemplate>
</ext:TreeGridColumn>
</Columns>
<Root>
</Root>
<Listeners>
<BeforeClick Handler="return !Ext.fly(e.getTarget()).is('input[type=text]');" />
</Listeners>
</ext:TreeGrid>