Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
170
WDG Multline textboxprovider - setting number of rows
posted

when a user clicks in the multiline tb provider to edit existing text or add a new row, i would like to increase the number of rows to 10

Currently, the textbox has only enough rows to accommodate the text - even though i set it to 10 in the provider

I would like to increase this in the cell edit entering event, if possible

I have this so far


function grid_CellEditing_EnteringEditMode(sender, e)
{

var c = e.getCell();
var key = c.get_column().get_key();


// Add a new line to log_text
if (key == "log_text")
{
var t = c.get_value();
// Add a blank line and, ideally, set cursor to end
if (t != "")
c.set_value(t + "\r\n");

i need to do something equivalent to 

c.rows.count = 10


markup


<EditorProviders>
<ig:TextBoxProvider ID="Chrono_MultiLineTextBoxProvider">
<EditorControl ClientIDMode="Predictable" Height="300px" MaxLength="10000"
TextMode="MultiLine" Width="500px" Rows="10"></EditorControl>
</ig:TextBoxProvider>

Thanks!

Parents
No Data
Reply
  • 1700
    Offline posted

    Hello Peter, 

    This could be achieved by changing the value of the cell that contains the Multiline TextEditorProvider and adding the empty lines in the EnteredEditMode event of the grid, after the user has finished editing the cell value, the ExitedEditMode event should be used and the value of the cell should be trimmed in order to not save the empty lines at the end. In case you would like to use the enter for creating new line inside the cell, the ExitingEditMode event could be used, the enter key press should be checked and the ExitingEditMode should be cancelled to retain edit mode.

    I am pasting the code for the events below:

    function WebDataGrid1_CellEditing_ExitingEditMode(sender, eventArgs)
        {
    	    if (eventArgs.getCell().get_column().get_key() == "Site") {
                if (eventArgs.get_browserEvent().keyCode == 13) {
                    eventArgs.set_cancel(true);
                }
            }
        
        }
    
        function WebDataGrid1_CellEditing_EnteredEditMode(sender, eventArgs) {
            var cell = eventArgs.getCell()
            if (cell.get_column().get_key() == "Site") {
                var cellValue = cell.get_value() + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n";
                cell.set_value(cellValue);
            }
        }
    
        function WebDataGrid1_CellEditing_ExitedEditMode(sender, eventArgs) {
            var cell = eventArgs.getCell()
            if (cell.get_column().get_key() == "Site") {
                var cellValue = cell.get_value();
                cellValue = cellValue.trim();
                cell.set_value(cellValue);
            }
        }

    Please let me know if you have any questions.

    Regards,
    Ivan Kitanov

Children