Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

defaultsTo #36

Open
misterjt opened this issue Oct 28, 2015 · 6 comments
Open

defaultsTo #36

misterjt opened this issue Oct 28, 2015 · 6 comments

Comments

@misterjt
Copy link

Добавьте, пожалуйста, при редактировании или добавлении записи дефолтное значение полей, указанное в defaultsTo.

@misterjt
Copy link
Author

И ещё один маленький недостаток - если значение поля integer = 0, то это значение не выводится нигде. Как будто это поле пустое. Видимо, косяк с проверками (да, в JS с этим туго).
У вас скорей всего написано что-то вроде

if( !! field )

Надо заменить это на такую проверку

if( typeof field!='undefined' )

@konstantinzolotarev
Copy link
Owner

OK. Will add today night.
And will release in sails-hook-adminpanel@beta

@misterjt
Copy link
Author

Still have the same problems.
npm install sails-hook-adminpanel@beta
Version in package.json is 1.0.11

@konstantinzolotarev
Copy link
Owner

Hmm. Could you please send me your model ?

@misterjt
Copy link
Author

/**
* Proxy.js
*
* @description :: TODO: You might write a short summary of how this model works and what it represents here.
* @docs        :: http://sailsjs.org/#!documentation/models
*/

module.exports = {

    attributes: {
        url:'string',
        instagram_used:{
            type:'integer',
            defaultsTo:0
        }   
    }
};

@misterjt
Copy link
Author

Я извиняюсь, что на русском, просто на английском не смогу мысль выразить так, как хочу.
Я имею в виду, когда указано defaultsTo, что бы при создании новой записи у поля было по умолчанию указано value. А то приходится вручную каждый раз вписывать значение 0. И оно ещё потом в таблице показывается как пустое место.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants