jQWidgets Forums

jQuery UI Widgets Forums Grid validation grid depending row

This topic contains 2 replies, has 2 voices, and was last updated by  mathod 6 years, 5 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • validation grid depending row #103139

    mathod
    Participant

    Hello !
    I want to make a cell validation depending of others rows of my grid.

    For example, if value of my row n°2 = 10, my value of my row n°3 can’t be less than 10.

      columns: any[] =
      [   
          { text: 'Date', datafield: 'date',width: 100, cellsalign: 'center',
            validation : function (cell,value){
              console.log(this.myGridRate.getrows());
    
              return true;
            }
        },
          { text: 'Prix HT(cents)', datafield: 'price',width: 100, cellsalign: 'center' },
          { text:'Delete', datafield:'Delete',width: 50, columntype:'button',
         cellsrenderer:() :string => {
           return 'Delete';
         },
          buttonclick:(row:number):void =>{
            var id = this.myGridRate.getrowid(row);
            this.myGridRate.deleterow(id);   
            this.save();   
        } 
      }
      ];

    but
    console.log(this.myGridRate.getrows());
    doesn’t work… i can’t read my grid to analyze other rows.

    I hope you will understand my problem…
    Thank you !

    validation grid depending row #103141

    Martin
    Participant

    Hello mathod,

    This is because the validation function creates its own scope and you don’t have access to this.myGridRate there.
    Instead, you should use an arrow function.
    Here is an Example.

    Best Regards,
    Martin

    jQWidgets Team
    http://www.jqwidgets.com/

    validation grid depending row #103151

    mathod
    Participant

    Thanks a lot Martin.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.