Announcement

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

    ListGrid and Check BOX

    The first question is, why the first newly created line won't display( through createRecordComponent)?

    The other question is, for such kind of grid, what is the right way to summit data ? Please give me the sample code , if possible. Thanks!
    Attached Files

    #2
    Don't take this approach (using createRecordComponent() to simulate inline editing) unless you really have no choice. Use the inline editing subsystem (setCanEdit(true)) instead and use setEditorType() to customize editors. Then you will have automatic saving, correct keyboard navigation between editors, and many other difficult to implement features automatically handled for you.

    Comment


      #3
      I have a list grid and set the selection appearance as CHECKBOX, note that the header for the checkbox column is also a checkbox (for check all). Is there a way to place "Delete" on the header instead of a checkbox?

      Comment


        #4
        As the attached file shows the requirement,
        would you please give me a complete custom Editor sample code, using setEditorType() ? I need to know how to manipulate the widget and data/datasource.

        I believe it needs so many skill , is too hard for a novice developer.
        Attached Files

        Comment


          #5
          This looks like two RadioGroupItems with vertical layout and rowSpan 3, followed by three TextItems. Put all that in a DynamicForm, and then make a CanvasItem that uses that DynamicForm as it's Canvas.

          Comment


            #6
            How about the DataSource ? The grid DataSource is different from the DynamicForm Data Source ? When I get value from the embedded form, how can I set value to the grid datasource , and complete the whole custom editing
            Code:
            Then you will have automatic saving, 
            correct keyboard navigation between editors, 
            and many other difficult to implement features automatically handled for you.

            Comment


              #7
              If you're building a custom item based on CanvasItem, use getForm().setValue() to deliver the value of the CanvasItem to the form embedded within the grid. For example, in your use case you might do this when the user clicks on one of your radio buttons. Everything else (change tracking, saving when the user completes editing) is automatic.

              Comment


                #8
                Sorry, I would like to clarify my point, or maybe I still do not catch your hint...

                if I change the TextItem to a selctItem or a comboBox and allow multiselection, I may need a option datasource. So, if I get values from selection, eventurally , I need to pass the radion button picked and the selection of the selectItem to the [GRID] datasource. Through what interface? method ? How automatically ? should I composite the values to a object first ? should I concate the values as a whole string and then parse it before store to DB ? I don't know the exactly steps....

                Comment


                  #9
                  Say you're in a TextItem within a DynamicForm that is the canvas for a CanvasItem. Get the form from the CanvasItem and call setValue() on that.

                  As far as how to save it (composite or separate values) that depends both on what you want to do with it and how it's stored. If the values being edited are distinct database columns and distinct DataSource Fields, the easiest thing to do is make one ListGrid column per DataSource field, with one editor in each column editing one atomic value (like a string or boolean).

                  If you're providing a custom interface to edit a value that is saved to a single field, just use setValue() to provide it to the grid, using that single fieldName.

                  If you're doing something, please explain in detail what the editor is editing and the ideal way that you'd like to save it.

                  Comment


                    #10
                    Please check for the following steps for me...
                    1.ListGridField.setEditorType(FormItem ), I can not put a dynamic form as a parameter into the setEditorType. so,if I want to implement a DynamicForm-like widget as a cutomize editor of a ListGridField, I must then..
                    2.subclass FormItem as a CustomEditor, with composite FormField in a DynamicForm
                    3.override the method to pass value to the FormItem
                    4. make some logic to get/composite value through DynamicForm editing
                    5. put this custom FormItem into ListGridField.setEditorType() as parameter

                    Is that right ?

                    Comment


                      #11
                      Again, CanvasItem is what you use if you want to be able to use a DynamicForm as a field editor, and the docs for CanvasItem tell you (as we mentioned in this thread) that you provide values to the form you are participating in by calling form.setValue() on it.

                      Please look over the preceding advice very carefully, specifically, the advice on the simplest approach being multiple atomic editors. Use that approach if you can.

                      Comment


                        #12
                        So anyone knows how to alter a ListGrid Checkbox header and replace it with say "Del" or "Delete" ?

                        Comment


                          #13
                          if I make a subclass of CanvasItem, named MyEditorForm
                          what type should I set for the fld2 ? fld2.setType(ListGridFieldType.values());
                          The method setType(ListGridFieldType) in the type ListGridField is not applicable for the arguments (ListGridFieldType[])

                          When can I do that ?
                          form.getForm().setValues(Map);
                          form.getForm().getValues(Map);
                          In my DMI method ? how to ?

                          Code:
                          public class GUI implements EntryPoint {
                          
                          	public void onModuleLoad() {
                          		Canvas canvas = new Canvas();
                          		
                          		ListGrid listGrid = new ListGrid();
                          		ListGridField fld1 = new ListGridField("fld1", "AAA");
                          		ListGridField fld2 = new ListGridField("fld2", "BBB");
                          		fld1.setWidth("50px");
                          	    fld2.setCanEdit(true);
                          	    MyEditorForm form = new MyEditorForm();
                          	    fld2.setEditorType(form);
                          	    fld2.setType(ListGridFieldType.values());
                          	    listGrid.setAlwaysShowEditors(true);
                          	
                          		listGrid.setFields(new ListGridField[] { fld1, fld2});
                          				
                          		listGrid.setAutoFetchData(true);
                          		listGrid.setShowAllRecords(true);
                          		canvas.addChild(listGrid);
                          		listGrid.setRect(289, 26, 327, 100);
                          
                          		canvas.draw();
                          	}
                          }
                          Code:
                          public class MyEditorForm extends CanvasItem{
                          
                          	public MyEditorForm(){
                          		
                          		DynamicForm dynamicForm = new DynamicForm();
                          		dynamicForm.setNumCols(6);
                          		BooleanItem booleanItem = new BooleanItem();
                          		booleanItem.setTitle("chk1");
                          		BooleanItem booleanItem_1 = new BooleanItem();
                          		booleanItem_1.setTitle("chk2");
                          		dynamicForm.setFields(new FormItem[] { booleanItem, booleanItem_1, new SelectItem("select1", "select")});
                          		setCanvas(dynamicForm);
                          		dynamicForm.setRect(53, 213, 372, 88);
                          	}
                          }

                          Comment


                            #14
                            Is it possible to pass some arguments to MyEditoForm ? Can the arguments be
                            data from the current record ( such like fld1), so I can show different custom editor form accordingly?

                            Any Event attached to the editor entry ( such like entryEditorEvent) ?

                            Comment


                              #15
                              If the type of the field is a Map or Record, create a DataSource for it and set the field to DataSource type.

                              Comment

                              Working...
                              X