PDA

View Full Version : [CLOSED] How to enable pineditor after inserting a new row



blueworld
Apr 09, 2013, 2:09 PM
Hello,

I have a Adressbook similar to this demo:

http://examples2.ext.net/#/GridPanel/ComponentColumn/Pin_Editor/

This is the editing start/stop edit function like in the demo:



var pinEditors = function (btn, pressed) {
var columnConfig = btn.column,
column = columnConfig.column;

if (pressed) {
column.pinOverComponent();
column.showComponent(columnConfig.record, true);
App.buttonSave.disable();
} else {
column.unpinOverComponent();
column.hideComponent(true);
App.buttonSave.enable();
}
};


I have a 'New' button that adds a new row:



<ext:Button ID="ButtonAdd" runat="server" Text="Neu" Icon="Add" ToolTip="Neuen Eintrag hinzuf&uuml;gen">
<Listeners>
<Click Handler="var rowIndex = #{GridPanelAddress}.store.insert(0, {}); #{GridPanelAddress}.getView().focusRow(0);" />
</Listeners>
</ext:Button>


Is there any way to activate the edit mode (with a toggled pin button) after the new row has been inserted? Currently, the user needs to hover the empty row and click the pin editor button.

Regards

Daniil
Apr 09, 2013, 3:01 PM
Hi @blueworld,

Please try the following:

<ext:Button runat="server" Text="Add" Icon="Add">
<Listeners>
<Click Fn="add" />
</Listeners>
</ext:Button>


var add = function () {
var grid = App.GridPanel1,
column = App.ComponentColumnWithEditButton,
record = grid.getStore().insert(0, {})[0];

column.showComponent(record, grid.getView().getNode(0), 0);
column.overComponent.toggle();

};

blueworld
Apr 09, 2013, 3:56 PM
Hi Daniil,

thank you very much, this is very nice!
Would it be possible to move the cursor into the first cell after the edit mode has been enabled ? (row 0,column 0)

Daniil
Apr 09, 2013, 4:28 PM
Would it be possible to move the cursor into the first cell after the edit mode has been enabled ? (row 0,column 0)

I think it is possible. I would call the focus method on a ComponentColumn's component.