Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Dynamically adding rows to listgrid

    I have created one list grid with groupby. First i want to display all group by fields and afer that if we expand the we need to add the rows dynamically to that group.

    Example:

    Finanace-Sec1
    Finanace-Sec2

    if i click on the Finanace-Sec1 header then i need to add the questions related Finanace-Sec1

    Finanace-Sec1
    Fin Question1
    Fin Question2
    Finanace-Sec2
    Fin Question1
    Fin Question2

    First time only we need to concat the server (means if already loaded data for that group then existing loaded data should be shown to user)
    Last edited by nasbobba@yahoo.com; 22 May 2009, 11:45.

    #2
    Call addData().

    Comment


      #3
      I have created a listgrid and datasource is attached to the listgird.

      On button click, I am getting the data from the RPC call and adding that data to the datasource by using the dataSource.addData(rec).

      But the data is not displaying in the listgrid.

      Comment


        #4
        Post a standalone test case in the format.

        Code:
        public void onModuleLoad() {
        ...
        }

        Comment


          #5
          Hi sjivan,

          Code:
          listGrid.setSelectionType(SelectionStyle.SINGLE);
          listGrid.setSelectionAppearance(SelectionAppearance.CHECKBOX);
          ListGridField sectionSetNameField = new ListGridField("sectionSetName", "Set(s) and Questions", 400);
          ListGridField unansweredField = new ListGridField("unanswered", "Unanswered", 100);
          
          listGrid.setFields(sectionSetNameField,unansweredField);
          listGrid.setDataSource(dataSource);
          listGrid.setAutoFetchData(true);
          
          public void onNodeClick(NodeClickEvent event) {
          				ListGridRecord rec = treeGrid.getSelectedRecord();
          				SC.confirm("Proceed with RPC Call Test?", new BooleanCallback() {
                              public void execute(Boolean value) {
                                  if (value != null && value) {
                                  	TestServiceAsync service = GWT.create (TestService.class);
                      				ServiceDefTarget target = (ServiceDefTarget) service;
                      				target.setServiceEntryPoint(GWT.getModuleBaseURL() + "/test");
                      		        //Window.alert("" + GWT.getModuleBaseURL() + "test");
                      				service.fetch (new AsyncCallback<ArrayList<SectionSets>> () {
                  			            public void onFailure (Throwable caught) {
                  			               
                  			            }
                  			    		@Override
                  						public void onSuccess(ArrayList<SectionSets> result) {
                  							for (int i=0;i<result.size();i++) {
                  								SectionSets sec = result.get(i);
                  								ListGridRecord record = new ListGridRecord();
                  								record.setAttribute("sectionSetName", sec.getSectionSetName());
                  								record.setAttribute("unanswered", sec.getUnanswered());
                  								dataSource.addData(record);
                  								
                  							}
                  						}
                  			        });
                                  	                        	
                                  }                     }
                          });
          			}
                  	
                  });

          on tree node click i am adding data to listgrid datasource. The result is adding to the datasource by using the addData method, but that data is not displaying on the listgrid.
          Last edited by nasbobba@yahoo.com; 22 May 2009, 20:32.

          Comment


            #6
            Do you have a primary key defined on your DataSource? Check the Developer Console logs. There are working samples of this in the Showcase.

            Again, you need to post a standalone sample in the format :

            Code:
            public void onModuleLoad() {
            ...
            }

            Comment


              #7
              Instead of using the setAttribute, I have used the one class extending with ListGridRecords then records are displaying.

              But if i used listGrid.groupBy("sectionSetName","unanswered") for multiple colums then it is throwing an error(can not change the property after component has been created) for setAutoFetchData and setSelectionAppearance(unable to load the module).

              1) How to set the multple colums groupby in listgrid?

              2) How to load the data lazyly with the expand of header?
              Last edited by nasbobba@yahoo.com; 25 May 2009, 06:45.

              Comment


                #8
                grouping is working after adding the listGrid.setCanGroupBy(true);

                is it possible to load the data after clicking on group header(after clicking on header i need to call method and returned rows should be added to the selected group)?
                Last edited by nasbobba@yahoo.com; 25 May 2009, 12:27.

                Comment

                Working...
                X