Results 1 to 2 of 2

Thread: Set value in a date field in a grid cell

  1. #1
    Sencha Premium Member
    Join Date
    Nov 2014
    Posts
    10
    Vote Rating
    0
      0  

    Default Set value in a date field in a grid cell

    Hi

    I have a grid in which the second column is a date field.
    What is the ST code for adding a value for date, in any row of this grid?

    Thank you,
    Cenoy

  2. #2
    Sencha - Sales Team daniel.gallo's Avatar
    Join Date
    Apr 2009
    Location
    Redwood City, CA
    Posts
    229
    Answers
    25
    Vote Rating
    23
      0  

    Default

    Please take a look at the example test suite below. This shows how to use the Futures APIs to replicate a user's interactions with the cell editing plugin on a grid, and interact with the date picker to set the date, then check the updated value in the grid.

    This test suite can be run against the following example in the Kitchen Sink: http://examples.sencha.com/extjs/6.5...c#cell-editing.

    Code:
    describe('Editable grid', function() {
        it('Should edit the cell when clicked', function() {
            // Reference the cell containing the date field and click it
            // If the grid is using the cell editing plugin, it will become editable
            ST.grid('cell-editing')
                .rowAt(2)
                .cellAt(3)
                .click()
                .down('.x-form-trigger');
        });
        
        it('Should display the date picker and select the current date', function() {
            // Click on the date picker's trigger
            ST.grid('cell-editing')
                .rowAt(2)
                .cellAt(3)
                .down('.x-form-trigger')
                .click();
                
            // Check date picker is visible
            ST.component('datepicker')
                .visible();
            
            // Click the "Today" button in the date picker
            ST.component('datepicker button[text=Today]')
                .click();
                
            // Click away from the cell - click on the grid header
            ST.component('cell-editing header')
                .click();
        });
        
        it('Should have the correct date in the grid cell', function() {
            // Get the current date as a formatted string
            var currentDate = new Date().toLocaleDateString("en-US", {
                year: "numeric", 
                month: "short",
                day: "2-digit"
            });
             
            // Check the cell value matches current date
            ST.grid('cell-editing')
                .rowAt(2)
                .cellAt(3)
                .text(currentDate);
        });
    });
    Daniel Gallo
    Senior Solutions Architect
    Sencha Inc.

Similar Threads

  1. Replies: 1
    Last Post: 29 Mar 2016, 5:41 AM
  2. [DUP] Date field cell editor hidden when selecting year
    By mankz in forum Ext 5: Bugs
    Replies: 1
    Last Post: 29 Aug 2014, 9:16 AM
  3. cant edit date field with current date in editable grid
    By sthanar in forum Ext 3.x: Help & Discussion
    Replies: 1
    Last Post: 13 Jan 2014, 9:45 AM
  4. Replies: 2
    Last Post: 12 Apr 2012, 8:17 AM
  5. wrong value on the grid's date field if date is blank
    By hellosudhir in forum Ext 3.x: Help & Discussion
    Replies: 3
    Last Post: 10 Jan 2011, 4:13 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •