Announcement

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

    Calendar Widget

    Hello all,

    I am a newbie to SmartGWT (have decent exposure to GWT). I was interested in the the Calendar Widget, started playing with the source code for the Calendar demo in showcase (http://www.smartclient.com/smartgwt/showcase/#workday_calendar_category). Unfortunately, the documentation for the Calendar (and most of the widgets) is non-existent or the javadocs is extremely confusing. I am unable to comprehend seemingly important "stuff" in that example. Particularly, these lines of code
    Code:
    DataSourceTextField nameField = new DataSourceTextField("name");
    		DataSourceTextField descField = new DataSourceTextField("description");
    		descField.setCanEdit(false);
    		
    		DataSourceDateField startDateField = new DataSourceDateField(
    				"startDate");
    		DataSourceDateField endDateField = new DataSourceDateField("endDate");
    
    		eventDS.setFields(eventIdField, nameField, descField, startDateField,
    				endDateField);
    Commenting/Uncommenting the fields (except the eventIdField) seems to have no effect on the events in the rendered Calendar. Could someone please help me understand the basics of the Calendar Widget? Also, could someone please point to any books/documentation/paid training material to learn SmartGWT. Thanks much!!

    - chandra

    #2
    Start with the QuickStart guide to understand what a DataSource is and get an overview of data binding. Then look at the Calendar class docs and the docs for startDateField, endDateField et al.

    Comment


      #3
      Originally posted by Isomorphic
      Start with the QuickStart guide to understand what a DataSource is and get an overview of data binding. Then look at the Calendar class docs and the docs for startDateField, endDateField et al.
      didnt notice quick start guide. will do. thanks

      Comment


        #4
        Originally posted by Isomorphic
        Start with the QuickStart guide to understand what a DataSource is and get an overview of data binding. Then look at the Calendar class docs and the docs for startDateField, endDateField et al.
        Hello, I looked at the databinding section in the Quickstart guide. I am still a little bit confused regarding Calendar API.

        Basically, how could I get to render an "uneditable item" when i select to edit an event (is it even acceptable to render an "uneditable item"?). I tried the following but unable to get uneditable items (StaticTextItem) to be uneditable. Here is the code:

        Code:
        	DataSource eventDS = new DataSource();
        		DataSourceSequenceField eventIdField = new DataSourceSequenceField("eventId");
        		eventIdField.setPrimaryKey(true);
        
        		DataSourceTextField nameField = new DataSourceTextField("name");
        		DataSourceTextField descField = new DataSourceTextField("description");
        		descField.setCanEdit(false);
        		DataSourceDateField startDateField = new DataSourceDateField("startDate");
        		DataSourceDateField endDateField = new DataSourceDateField("endDate");
        
        		eventDS.setFields(eventIdField, nameField, descField, startDateField,
        				endDateField);
        		eventDS.setClientOnly(true);
        		
        		Record record = new Record();
        		record.setAttribute("eventId", 1);
        		record.setAttribute("name", "foo");
        		record.setAttribute("description", "foo bar");
        		record.setAttribute("startDate", new Date(year, month, start + 2, 9, 0, 0));
        		record.setAttribute("endDate", new Date(year, month, start + 2, 14, 0, 0));
        		record.setAttribute("href", "http://www.foo.com");
        		
        		eventDS.setTestData(new Record[]{record});
        		
        		Calendar calendar = new Calendar();
        				
        			
        		StaticTextItem nameItem = new StaticTextItem("name");		
        		StaticTextItem descItem = new StaticTextItem("description");        
                StaticTextItem hrefItem = new StaticTextItem("href");        
                
                
                calendar.setEventEditorFields(descItem, hrefItem);
                calendar.setEventDialogFields(nameItem, descItem);       
        	
        		calendar.setShowWeekends(false);
        		calendar.setShowWorkday(true);
        		calendar.setScrollToWorkday(true);
        		calendar.setDataSource(eventDS);
        		calendar.setAutoFetchData(true);
        
        		calendar.draw();
        Also, couple of questions:

        1. calendar.setUseAllDataSourceFields(true); doesn't have any effect.
        2. Is it possible to supress rendering certain fields (e.g., description field) in the "Edit" window/view.
        3. In the javadocs (http://www.smartclient.com/smartgwt/javadoc/) for Calendar, beneath setEventEditorFields() method, I see this statement - "See the Customized Binding example below for more information on altering default datasource fields within forms. " but I am unable to find an example in that page - am I missing something?

        I appreciate your help.

        Thank you

        Comment


          #5
          any suggestions please?


          thanks

          Comment


            #6
            You're not likely to get a reply. Most of your questions are covered in the Quick Start guide, as well as the general concept sections on Data Binding and data-bound components in the help reference. I know it's frustrating but stick with it. It'll be worth the learning curve.

            Comment

            Working...
            X