How to find a value in GridPanel column?

  1. #1

    How to find a value in GridPanel column?

    Hi,

    I need to validate that a record inserted does not have some values that already exist in the database like for example a "name".

    Could you tell me please how can I find a column value to acomplish what I want?

    Thanks,
  2. #2

    RE: How to find a value in GridPanel column?



    We are enforcing data integrity in our mssql database using eg triggers or unique indexes depending on the requirements

    I am assuming that you will do this serverside?

    rgds
  3. #3

    RE: How to find a value in GridPanel column?



    Hi,

    I do not want the user to see the system validation, I want to show a clear message.

    Most of the grids provide a method to find a column value, like for example to look on the column name an employee's name like "Maria".

    If I can verify the name on the grid and do not have to go to the database to validate that the name does not exists.

    Can I do that with the Grid panel?

    Thanks,
  4. #4

    RE: How to find a value in GridPanel column?



    flormariafr (1/23/2010)
    I do not want the user to see the system validation, I want to show a clear message.
    Not a problem

    You use the exception.message to get the clean error from the database
    mssql supports using customized error messages

    Most of the grids provide a method to find a column value, like for example to look on the column name an employee's name like "Maria".
    Correct

    If I can verify the name on the grid and do not have to go to the database to validate that the name does not exists.
    In this you assume that you always have all data available on the client and you do not apply any form of filtering to the data in the grid
    Would this be the case?

    I don't know if it's possible to look up existing data in the store on the clientside
    I have tables with > 2000 rows and I need to have filters

    [EDIT] I had a quick look in the ExtJS documentation
    The store has a method called "collect" you might be able to use for you purpose

    http://www.extjs.com/deploy/dev/docs...Ext.data.Store
    collect( String dataIndex, [Boolean allowNull], [Boolean bypassFilter] ) : Array
    Collects unique values for a particular dataIndex from this store.
    Other methods you should look at

    find( String fieldName, String/RegExp value, [Number startIndex], [Boolean anyMatch], [Boolean caseSensitive] ) : Number
    Finds the index of the first matching Record in this store by a specific field value.


    findBy( Function fn, [Object scope], [Number startIndex] ) : Number
    Find the index of the first matching Record in this Store by a function. If the function returns true it is considered a match.


    findExact( String fieldName, Mixed value, [Number startIndex] ) : Number
    Finds the index of the first matching Record in this store by a specific field value.
    Please note: This effectively stops you from using any remote filtering on the data as you are not able to search the whole dataset when filtering are applied

    rgds

Similar Threads

  1. GridPanel can not find store
    By zhdl in forum 2.x Help
    Replies: 1
    Last Post: Jul 25, 2012, 5:55 PM
  2. Replies: 7
    Last Post: Mar 21, 2012, 10:24 AM
  3. [CLOSED] GridPanel: RowSelect Error - Cannot Find RowSelectionModel
    By nhg_itd in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Oct 04, 2011, 9:27 AM
  4. find row index in gridpanel
    By aditya.murthy88@gmail.com in forum 1.x Help
    Replies: 2
    Last Post: Dec 11, 2010, 12:06 PM
  5. Replies: 15
    Last Post: Oct 08, 2009, 10:33 AM

Posting Permissions