javascript - How to use predicates on expanded entities in breeze -


lets have entity called foo , has list of bars. bars contains field called isdeleted indicates particular bar has been soft deleted. want able query specific foo , filter out bars soft deleted inside of javascript file using breeze. thought work...

var query = breeze.entityquery.from('foo')         .where('id', '==', id).and('bars.isdeleted', '==', false)         .expand('bars'); 

however not, can tell me how in breeze? if solution code method in breezecontroller , use standard linq syntax fine want see if work @ in breeze first.

multiple .where() chains on query will automatically "and" together. if want explicity, need use breeze.predicate object parameter so:

var query = breeze.entityquery.from('foo').expand('bars')     .where(new breeze.predicate('id', 'eq', id)                      .and('bars.isdeleted', 'eq', false)); 

you can choose use .or or other method on predicate object, of them chain properly.

edit: here example of using multiple .where calls:

    var query = breeze.entityquery.from('foo').expand('bars')                 .where('id', 'eq', id)                 .where('bars.isdeleted', 'eq', false); 

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -