Mar 25, 2021, 9:29 AM
How to Checked Checkbox on dynamic gridpanel
Hi,
I have a Gridpanel with dynamic checkbox. The goal is when Detail Checkbox Checked, the current record View Checkbox is auto checked with true value.
The issue is, the view checkbox already Checked, but the detail checkbox not checked. in the console of the browser i got the error with cmp.record is undefined. i already attached the images.
here is the code snippet
I have a Gridpanel with dynamic checkbox. The goal is when Detail Checkbox Checked, the current record View Checkbox is auto checked with true value.
The issue is, the view checkbox already Checked, but the detail checkbox not checked. in the console of the browser i got the error with cmp.record is undefined. i already attached the images.
here is the code snippet
function ComboBoxDetail_ClientChange(obj, currentSelected, lastSelected) {
console.log(obj)
if (currentSelected) {
var currId = obj.record.data.PK_Module_ID
window.App.StoreView.data.each(function (record) {
if (record.data.PK_Module_ID == currId) {
record.set('BView', currentSelected);
}
})
<ext:GridPanel ID="GridpanelAdd" ClientIDMode="Static" runat="server" Title="Title" AutoScroll="true">
<Store>
<ext:Store ID="StoreView" ClientIDMode="Static" runat="server" OnReadData="Store_ReadData">
<Model>
<ext:Model runat="server" ID="modelgrid" IDProperty="PK_Module_ID">
<Fields>
<ext:ModelField Name="BView" Type="String">
<Convert Handler=" if (value === 'Y') { return true } else { return value};" />
</ext:ModelField>
<ext:ModelField Name="BDetail" Type="String">
<Convert Handler=" if (value === 'Y') { return true } else { return value};" />
</ext:ModelField>
<ext:ModelField Name="IsView" Type="Boolean"></ext:ModelField>
<ext:ModelField Name="IsDetail" Type="Boolean"></ext:ModelField>
</Fields>
</ext:Model>
</Model>
</Store>
<Plugins>
<ext:FilterHeader ID="GridHeader1" runat="server" Remote="false" ClientIDMode="Static" />
</Plugins>
<ColumnModel ID="ColumnModel1" runat="server">
<Columns>
<ext:ComponentColumn ID="ComponentView" runat="server" Editor="true" DataIndex="BView" Flex="1" Text="View" Align="Center">
<Component>
<ext:Checkbox ID="ComboBoxView" runat="server" Editor="true" DataIndex="BView" Flex="1" Text="View"></ext:Checkbox>
</Component>
<Listeners>
<BeforeBind Handler=" if (e.record.data.IsSupportView==0) return false;"></BeforeBind>
</Listeners>
</ext:ComponentColumn>
<ext:ComponentColumn ID="ComponentDetail" runat="server" Editor="true" DataIndex="BDetail" Flex="1" Text="Detail" Align="Center">
<Component>
<ext:Checkbox ID="ComboBoxDetail" runat="server" Editor="true" DataIndex="BDetail" Flex="1" Text="Detail" >
<Listeners>
<Change Fn="ComboBoxDetail_ClientChange" />
</Listeners>
</ext:Checkbox>
</Component>
<Listeners>
<BeforeBind Handler=" if (e.record.data.IsSupportDetail==0) return false;"></BeforeBind>
</Listeners>
</ext:ComponentColumn>
</Columns>
</ColumnModel>