本文介绍了GWT EditTextCell:如何增加EditTextCell中可编辑的TextBox宽度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的项目中使用GWT2.3。
当用户点击editableTextCell时,我想增加editableTextBox的宽度。
问题是我的列宽度是200 Px。当用户点击editableTextCell时,EditableTextCell中的TextBox宽度大约为125px,与列宽相比较少。



我在Celltable的列中添加了EditTextCell



Column stringColumn = new Column(new EditTextCell()){
// My Code
}



cellTable。 addColumn(stringColumn,MyColumn);
cellTable.setColumnWidth(checkBoxColumn,200,Unit.PX);

我尝试了以下方法来增加TextBox宽度,但问题是我无法在文本框中编辑+ focus而不是损失
$ b $ $ p $ @Override
public void onBrowserEvent(Context context,Element elem,Record object,NativeEvent event){
String type = event.getType();

int editedTexBoxSize =(cellTable.getOffsetWidth() - 100)/cellTable.getColumnCount();

if(elem.getInnerHTML()。startsWith(< INPUT)){
String test = elem.getInnerHTML();
// test =< INPUT tabIndex = -1 value = P __eventBits =2048>< / INPUT>

test = test.replace(value,size =+ editedTexBoxSize +value);


// test =< INPUT tabIndex = -1 size = 131 value = P __eventBits =2048>< / INPUT>


elem.setInnerHTML(test);
}
super.onBrowserEvent(context,elem,object,event);
}

我想增加(设置)TextBox宽度出现在EditTextCell中等于列宽度。



任何解决方案?

解决方案

那:

  cellTable.getColumn(cellTable.getColumnIndex(column))。setCellStyleNames(CELL_CSS); 

.edit-cell input {
width:290px;
}


I am using GWT2.3 in my project.I want to increase editableTextBox width when user click on editableTextCell.Problem is My Column width is 200 Px. when user clicks on editableTextCell then that TextBox width is around 125px in EditableTextCell is less as compare to column width.

I added EditTextCell in Celltable's column

Column stringColumn = new Column(new EditTextCell()) {// My Code}

cellTable.addColumn(stringColumn, "MyColumn");cellTable.setColumnWidth(checkBoxColumn, 200, Unit.PX);

I tried following way to increase TextBox width but problem is I cannot edit in textbox + focus not losses

    @Override
            public void onBrowserEvent(Context context, Element elem,Record object, NativeEvent event) {
                String type = event.getType();

                  int editedTexBoxSize = (cellTable.getOffsetWidth()-100)/cellTable.getColumnCount();

                  if(elem.getInnerHTML().startsWith("<INPUT")){
                      String test = elem.getInnerHTML();
                     // test = <INPUT tabIndex=-1 value=P __eventBits="2048"></INPUT>

                     test= test.replace("value", " size="+editedTexBoxSize+" value");


                    // test = <INPUT tabIndex=-1 size=131 value=P __eventBits="2048"></INPUT>


                      elem.setInnerHTML(test);
                  }
                super.onBrowserEvent(context, elem, object, event);
            }

I want to Increase(set) TextBox width appear in EditTextCell is equal to column Width.

Any Solution ?

解决方案

In my project I do that:

cellTable.getColumn(cellTable.getColumnIndex(column)).setCellStyleNames(CELL_CSS);

.edit-cell input {
    width: 290px;
}

这篇关于GWT EditTextCell:如何增加EditTextCell中可编辑的TextBox宽度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-15 19:53