1. #1
    Ext User
    Join Date
    Aug 2008
    Posts
    25
    Vote Rating
    0
    jagadesh is on a distinguished road

      0  

    Default DateField Issue In Grid

    DateField Issue In Grid


    Hi Guys,

    iam using Editor grid panel. when i double click on the row it is should display DateField in the row to reenter the date.but in my application when i double click it is showing the DateField in the next row.

    iam attaching the Code, please sort me out

    protected void onRender(Element parent, int index) {
    super.onRender(parent, index);

    setLayout(new FitLayout());

    List<ColumnConfig> columns = new ArrayList<ColumnConfig>();
    columns.add(new ColumnConfig(DynamicFormDataResult.FORM_NAME,constants.DYNAMIC_FORM_ID_FORM_NAME(), 200));
    columns.add(new ColumnConfig(DynamicFormDataResult.VISIBILITY,constants.DYNAMIC_FORM_ID_VISIBILITY(), 130));
    columns.add(new ColumnConfig(DynamicFormDataResult.UPDATEDATE,constants.DYNAMIC_FORM_ID_UPDATE_DATE() , 140));
    columns.add(new ColumnConfig(DynamicFormDataResult.OFFICEID,constants.DYNAMIC_FORM_ID_OFFICE_NAME(), 200));

    /**
    * Editor Grids
    */

    /* DateField dateField = new DateField();
    dateField.getPropertyEditor().setFormat(DateTimeFormat.getFormat(constants.MYMDWORLD_DATE_FORMAT()));
    */
    columns.get(0).setEditor(new CellEditor(new TextField<String>()));

    final SimpleComboBox<String> combo = new SimpleComboBox<String>();
    combo.add(constants.DYNAMIC_FORM_ID_PUBLIC());
    combo.add(constants.DYNAMIC_FORM_ID_PRIVATE());

    CellEditor editor = new CellEditor(combo) {
    public Object preProcessValue(Object value) {
    if (value == null) {
    return value;
    }
    return combo.findModel(value.toString());
    }
    public Object postProcessValue(Object value) {
    if (value == null) {
    return value;
    }
    return ((ModelData) value).get("value");
    }
    };

    columns.get(1).setEditor(editor);
    columns.get(2).setEditor(new CellEditor(new DateField()));



    RpcProxy proxy = new RpcProxy() {
    public void load(Object loadConfig, AsyncCallback callback) {
    }
    };

    // loader
    BasePagingLoader loader = new BasePagingLoader(proxy);
    loader.setRemoteSort(true);

    loader.load(0, 50);

    formStore = new ListStore<DynamicFormDataResult>(loader);

    ColumnModel cm = new ColumnModel(columns);

    formGrid = new EditorGrid<DynamicFormDataResult>(formStore, cm);
    formGrid.setLoadMask(true);
    formGrid.setBorders(true);
    formGrid.setSize(400,250);
    formGrid.setClicksToEdit(EditorGrid.ClicksToEdit.TWO);

    formSelectionModel=new GridSelectionModel();
    formSelectionModel.bindGrid(formGrid);

    gridContentPanel= new ContentPanel();
    gridContentPanel.setFrame(false);
    gridContentPanel.setCollapsible(false);
    gridContentPanel.setAnimCollapse(false);
    gridContentPanel.setButtonAlign(HorizontalAlignment.LEFT);
    gridContentPanel.setIconStyle("icon-table");
    gridContentPanel.setHeading("FormS");
    gridContentPanel.setLayout(new FitLayout());
    gridContentPanel.add(formGrid);
    gridContentPanel.setSize(RESULT_TABLE_MINIMUM_WIDTH, RESULT_TABLE_MINIMUM_HEIGHT);

    ToolBar toolBar = new ToolBar();
    gridContentPanel.setBottomComponent(toolBar);

    }
    }


    can anyone sort me out.

    thank u,
    jagadesh

  2. #2
    Ext GWT Premium Member gslender's Avatar
    Join Date
    Mar 2008
    Location
    Brisbane, Australia
    Posts
    1,572
    Vote Rating
    4
    gslender is on a distinguished road

      0  

    Default


    2 things...

    1st, in the future, can you ensure code you post is surrounded in the [ code ] tags to ensure its readable (the # symbol tool item).

    2nd, not sure if this will solve your problem, but your selection model should really be obtained by calling grid.getSelectionModel()

    EditorGrid uses a CellSelectionModel not the plain GridSelectionModel, and this might be screwing things up ?? not sure though...

Thread Participants: 1