Hi,
I have created a Multi Column Tree in my SmartGWT application. The first column will have XML and the rest of the columns will have basic data. But when I execute the application its hangs and I get some script error saying "Script is taking too long to run .... ". I still continued with the message but it kept coming back again everytime.
My XML is not getting loaded in the Tree Grid.
The following is the code snippet :
The following is the XML:
Can you please help me out with this issue. I will really appreciate any sort of help. Thank you.
I have created a Multi Column Tree in my SmartGWT application. The first column will have XML and the rest of the columns will have basic data. But when I execute the application its hangs and I get some script error saying "Script is taking too long to run .... ". I still continued with the message but it kept coming back again everytime.
My XML is not getting loaded in the Tree Grid.
The following is the code snippet :
Code:
private TreeGrid getTreeGrid()
{
TreeGrid treeGrid = new TreeGrid();
treeGrid.setCanEdit(true);
treeGrid.setLoadDataOnDemand(false);
treeGrid.setWidth(600);
treeGrid.setHeight(300);
treeGrid.setShowOpenIcons(false);
treeGrid.setShowDropIcons(false);
treeGrid.setClosedIconSuffix("");
treeGrid.setAutoFetchData(true);
treeGrid.setShowConnectors(true);
TaskXmlDS taskXmlDS = TaskXmlDS.getInstance();
treeGrid.setDataSource(taskXmlDS);
TreeGridField taskNameField = new TreeGridField("taskName");
taskNameField.setFrozen(true);
TreeGridField taskDescField = new TreeGridField("taskDesc");
TreeGridField taskStartTimeField = new TreeGridField("taskStartTime");
TreeGridField taskEndTimeField = new TreeGridField("taskEndTime");
treeGrid.setFields(taskNameField, taskDescField, taskStartTimeField,taskEndTimeField);
return treeGrid;
}
Code:
public class TaskXmlDS extends DataSource {
private static TaskXmlDS instance = null;
public static TaskXmlDS getInstance() {
if (instance == null) {
instance = new TaskXmlDS("employeesDS");
}
return instance;
}
public TaskXmlDS(String id) {
setID(id);
setRecordXPath("/tasks/task");
DataSourceTextField taskNameField = new DataSourceTextField("taskName", "Task Name" , 128);
DataSourceTextField taskNameDesc = new DataSourceTextField("taskDesc", "Description", 100);
DataSourceTextField taskStartTime = new DataSourceTextField("taskStartTime", "Start Time", 80);
DataSourceTextField taskEndTIme = new DataSourceTextField("taskEndTime", "End Time", 80);
DataSourceIntegerField taskParentId = new DataSourceIntegerField("taskParentId", "Parent ID");
taskParentId.setPrimaryKey(true);
taskParentId.setRequired(true);
DataSourceIntegerField taskIdField = new DataSourceIntegerField("taskId", "Task ID");
taskIdField.setRequired(true);
taskIdField.setForeignKey(id + ".taskParentId");
taskIdField.setRootValue("0");
setFields(taskNameField, taskNameDesc, taskStartTime, taskEndTIme);
setDataURL("tasks.data.xml");
setClientOnly(true);
}
}
Code:
<tasks> <task> <taskId>1</taskId> <taskParentId>0</taskParentId> <taskName>Parent Task Name</taskName> <taskDesc>Parent Task Desc</taskDesc> <taskStartTime>taskStartTime</taskStartTime> <taskEndTime>taskendTime</taskEndTime> </task> <task> <taskId>2</taskId> <taskParentId>1</taskParentId> <taskName>Task 1</taskName> <taskDesc>Task 1 Desc</taskDesc> <taskStartTime>09-04-2009 10:00:00</taskStartTime> <taskEndTime>09-04-2009 10:30:00</taskEndTime> </task> <task> <taskId>3</taskId> <taskParentId>1</taskParentId> <taskName>Task 3</taskName> <taskDesc>Task 3 Desc</taskDesc> <taskStartTime>09-04-2009 10:30:00</taskStartTime> <taskEndTime>09-04-2009 10:45:00</taskEndTime> </task> </tasks>
Comment