1. #1
    Sencha User
    Join Date
    Feb 2013
    Posts
    12
    Vote Rating
    0
    jeffshaver is on a distinguished road

      0  

    Default Unanswered: Null value in model causing a blank row in grid

    Unanswered: Null value in model causing a blank row in grid


    Basically, I have a model like:

    Code:
    {name: 'cnoID', type: 'string', mapping: function(o) {
        var root = o.cnoTypeList[0] || false, val = root.id || false;
        if (root && val) return val;
    },
    {name: 'cnoType', type: 'string', mapping: function(o) {
        var root = o.cnoTypeList[0] || false, val = root.id || false;
        if (root && val) return val;
    }
    Well I figured out that those values can and will likely be null at some point. So the mapping kinda does its job. The return value for them is a blank string.

    Well, I am using this information in a grid. The columns dataIndexes are set to the names of the model values and it works out... Unless the values are empty strings.... Then it just inserts a blank row into the grid....

    I figured that the blank string was causing the blank row, so I used defaultValue: null to counteract it. It didn't work... It makes the value null, but it still inserts the blank row

    Anyone have this issue before or see what I am doing wrong? I am using EXT JS 4.1
    Last edited by jeffshaver; 12 Feb 2013 at 10:56 AM. Reason: A little peiece i missed

  2. #2
    Touch Premium Member
    Join Date
    Feb 2011
    Location
    NJ
    Posts
    311
    Answers
    59
    Vote Rating
    52
    droessner is a jewel in the rough droessner is a jewel in the rough droessner is a jewel in the rough

      0  

    Default


    Even if a field value for a record is empty, the grid will still show the row. You could add a filter to your store and filter out these blank records so that they don't show on the grid.

    http://docs.sencha.com/ext-js/4-1/#!...-method-filter

  3. #3
    Sencha User
    Join Date
    Feb 2013
    Posts
    12
    Vote Rating
    0
    jeffshaver is on a distinguished road

      0  

    Default But...

    But...


    What would be causing a blank row to display? If it isn't supposed to happen, then I am probably doing something wrong, right?

  4. #4
    Sencha User
    Join Date
    Feb 2013
    Posts
    12
    Vote Rating
    0
    jeffshaver is on a distinguished road

      0  

    Default Sorry....

    Sorry....


    I totally read that response wrong... I will try this tomorrow and will respond then. Thanks!

  5. #5
    Sencha User
    Join Date
    Feb 2013
    Posts
    12
    Vote Rating
    0
    jeffshaver is on a distinguished road

      0  

    Default


    I can't get it working. I add:

    Code:
    filters: [{
        function(item) {
            return item == '';
        }
    }]
    I just want to get rid of specific values that are blank, not the whole record. It looks like item is the whole record in that case

  6. #6
    Touch Premium Member
    Join Date
    Feb 2011
    Location
    NJ
    Posts
    311
    Answers
    59
    Vote Rating
    52
    droessner is a jewel in the rough droessner is a jewel in the rough droessner is a jewel in the rough

      0  

    Default


    Yes, you are correct, the item will refer to the entire record, but you can reference fields within the record by using the get method. If you wanted to exclude all records where the cnoId is blank you could define it as:

    Code:
    filters: [{
        function(item) {
            return item.get('cnoId') !== '';
        }
    }]

  7. #7
    Sencha User
    Join Date
    Feb 2013
    Posts
    12
    Vote Rating
    0
    jeffshaver is on a distinguished road

      0  

    Default What I had to do...

    What I had to do...


    Basically, I had to scrap mapping/converting altogether.

    I brought it into one store, and then inside the datachanged listener on the store, I pass that data to other stores, which the grids are now based on.

    It works this way.

    The problem was only parts of a record would be empty and I was using one store for multiple grids grabbing only pieces of the record.

Thread Participants: 1

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi