Jun 22, 2012, 8:39 PM
[CLOSED] Raw property is null when adding a node
Hi folks, when i append a node the raw property is null.
to reproduce the problem, please do the following steps:
Any idea to overcome this issue?
to reproduce the problem, please do the following steps:
- Click Append Child button
- Select the appended node
Any idea to overcome this issue?
<script type="text/javascript">
var appendChild = function () {
Ext.net.DirectMethod.request({
url: "/Example/GetNewChild",
cleanRequest: true,
success: function (result) {
App.TreePanel2.getRootNode().appendChild([result], false, true);
}
});
}
var selectNode = function (item,record,index) {
if (record.raw == null) {
alert("Raw is null");
}
else {
alert("Raw is not null");
}
}
</script>
<ext:Button Text="Append Child" runat="server">
<Listeners>
<Click Handler="appendChild();" />
</Listeners>
</ext:Button>
<ext:TreePanel ID="TreePanel2" SelType="Checkbox" runat="server" Title="Tree" Height="700"
Width="400" Margins="10" RootVisible="false" Border="false">
<Listeners>
<Select Fn="selectNode" />
</Listeners>
<Store>
<ext:TreeStore ID="TreeStore1" runat="server">
<Proxy>
<ext:AjaxProxy Url="/Example/LoadFakeChildren">
<ActionMethods Read="POST" />
<Reader>
<ext:JsonReader Root="data" />
</Reader>
</ext:AjaxProxy>
</Proxy>
</ext:TreeStore>
</Store>
<Root>
<ext:Node NodeID="0" Text="Root" />
</Root>
<Fields>
<ext:ModelField Name="Task" />
</Fields>
<ColumnModel>
<Columns>
<ext:TreeColumn ID="TreeColumn1" runat="server" Text="Task" Flex="2" Sortable="true"
DataIndex="Task" />
</Columns>
</ColumnModel>
</ext:TreePanel>
public AjaxResult GetNewChild()
{
AjaxResult result = new AjaxResult();
result.Result = new { Task = "raphael" };
return result;
}
public StoreResult LoadFakeChildren()
{
NodeCollection nodes = new NodeCollection(false);
for (int index = 1; index < 6; index++)
{
Node no = new Node();
no.NodeID = index.ToString() + DateTime.Now.Second;
no.CustomAttributes.Add(new ConfigItem { Name = "Task", Value = no.NodeID, Mode = ParameterMode.Value });
nodes.Add(no);
}
return new StoreResult { Data = nodes.ToJson() };
}
Last edited by geoffrey.mcgill; Jun 22, 2012 at 10:27 PM.
Reason: [CLOSED]