First commit
This commit is contained in:
103
application/demo/pages/testButton.js
Normal file
103
application/demo/pages/testButton.js
Normal file
@@ -0,0 +1,103 @@
|
||||
import user from "/user/user.js"
|
||||
|
||||
import collection from "/unify/collection.js"
|
||||
|
||||
import button from '/elements/button.js';
|
||||
|
||||
import OR from '/unify/sql/OR.js';
|
||||
|
||||
import AND from '/unify/sql/AND.js';
|
||||
|
||||
import LIKE from '/unify/sql/LIKE.js';
|
||||
|
||||
|
||||
export default class testbutton extends button{
|
||||
|
||||
text = "test"
|
||||
|
||||
async click() {
|
||||
|
||||
var a = new Array();
|
||||
|
||||
var b = new Object();
|
||||
|
||||
b.a = "this is a test"
|
||||
|
||||
b.b = "this works good."
|
||||
|
||||
a.push( b );
|
||||
|
||||
a.push( b );
|
||||
|
||||
a.push( b );
|
||||
|
||||
await this.test( a );
|
||||
|
||||
}
|
||||
|
||||
node async test() {
|
||||
|
||||
var users = new collection( user );
|
||||
|
||||
var filter = users.getFilter();
|
||||
|
||||
console.log("filter", filter);
|
||||
|
||||
// Compose Filter
|
||||
|
||||
//filter.search = AND( LIKE( filter.email, "josephDaniel@mail.com" ), LIKE( filter.username, "admin" ) );
|
||||
|
||||
filter.search = LIKE( filter.selectedUsers.email, "JosephDaniel@mail.com" );
|
||||
|
||||
filter.order = filter.groups;
|
||||
|
||||
|
||||
users.sync();
|
||||
|
||||
|
||||
|
||||
var rows = users.rows;
|
||||
|
||||
console.log( rows.length, rows );
|
||||
|
||||
// get first user
|
||||
var a = users.get( 0 );
|
||||
|
||||
console.log("users.get( 0 )", a.username.value);
|
||||
|
||||
console.log( "users.length()", users.length() );
|
||||
|
||||
// get and remove last item
|
||||
var b = users.pop();
|
||||
|
||||
console.log( "users.length()", users.length() );
|
||||
|
||||
console.log("users.pop()", b.username.value);
|
||||
|
||||
|
||||
|
||||
// get and remove first item
|
||||
var c = users.shift();
|
||||
|
||||
console.log( "users.length()", users.length() );
|
||||
|
||||
console.log("users.shift()", c.username.value );
|
||||
|
||||
|
||||
users.sync();
|
||||
|
||||
// get all rows
|
||||
var d = users.getRows();
|
||||
|
||||
console.log("users.getRows()",d.length);
|
||||
|
||||
|
||||
}
|
||||
|
||||
//node async test( a ) {
|
||||
|
||||
// console.log( a );
|
||||
|
||||
//}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user