[CLOSED] Field validation inside cellediting gridpanel

  1. #1

    [CLOSED] Field validation inside cellediting gridpanel

    How to validate fields inside gridpanel with client side scripting ,fields inside editor.

      X.Column()
                    .DataIndex("men")
                    .Text("Men")
                    .Editor(X.TextField()
                        .ID("txtMen")
                          
                        .CustomConfig(cc => cc.Add(new ConfigItem { Name = "initQuery", Value = "Ext.emptyFn", Mode = ParameterMode.Raw }))
                        .AllowBlank(false)
                    )
    Last edited by Daniil; Jul 22, 2014 at 8:07 PM. Reason: [CLOSED]
  2. #2
    Hi @matrixwebtech,

    Please describe what exactly you would like to do.

    Do you mean that AllowBlank="false" is not working? It appears to be working for me.
  3. #3
    Hi daniil

    please look http://forums.ext.net/showthread.php...el-editorfield

    here I design a gridpanel(on 1st post) with editor.I want to validate each field of each row on save button click.
    I use allowblank = false but its not working on save button click then i write bellow script


     .Listeners(l => l.Click.Handler = "return validation();")

    <script type="text/javascript">
          var validation = function () {
              
              var grid = App.GridPanel1;
              var j=0
              grid.getStore().each(function (item) {
                  //Ext.MessageBox.alert(item);
                  //console.log(item.data)
                  //var json = JSON.parse(item.data);
                  j = j + 1;
                  var row = item.data,
                     column;
    
                  for (column in row) {
                      if (row.hasOwnProperty(column)) {
                          //console.log(column + " = " + row[column]);
                          if (length(row[column]) <= 0 || row[column] == "0") {
                              Ext.MessageBox.alert("Fill all field at row "+ j);
                          }
                      }
                  }
                  
              })
              
             
              
          }
        </script>
    its validate the store but I not able to set a error message against the particular field which is blank and set focus to this control.can you please suggest me a best way to do this?
    Last edited by matrixwebtech; Jul 12, 2014 at 6:10 AM.
  4. #4
    A Column shares its Editor for all the rows. It means that there is the only ComboBox for all the rows. So, you won't be able to show an individual ComboBox for several rows of the same Column. I would say there is no built-in functionality to demonstrate visually the validation errors in a GridPanel. I would suggest you to try with a Column's Renderer. If a cell's value is not valid, then show an error in the cell.

    but I not able to set a error message against the particular field which is blank and set focus to this control.
    You could start editing programmatically on the cell of the specific row and column. The shown editor field should be validated according to its validation settings.
  5. #5
    can you please some example of Column's Renderer
  6. #6
    I would say there is a Renderer used in the most of our GridPanel examples.

Similar Threads

  1. [CLOSED] GridPanel CellEditing highlight
    By cwolcott in forum 2.x Legacy Premium Help
    Replies: 3
    Last Post: Nov 12, 2013, 11:32 AM
  2. [CLOSED] gridpanel - CellEditing causing javascript error
    By PriceRightHTML5team in forum 2.x Legacy Premium Help
    Replies: 3
    Last Post: Oct 04, 2013, 5:44 AM
  3. CellEditing not recognized in GridPanel
    By stebag in forum 2.x Help
    Replies: 0
    Last Post: Oct 07, 2012, 5:48 AM
  4. Replies: 2
    Last Post: Sep 22, 2011, 11:46 AM
  5. Replies: 2
    Last Post: Aug 19, 2011, 1:36 PM

Posting Permissions