Closed Raphael-Stellwag closed 5 years ago
I am glad to know - you find jsstore cool.
Could you please provide me your db schema and some json data. So that I can reproduce the issue. You can export your tables data using exportJson.
Thanks
Thanks for your quick answer.
My db schema looks like this:
const tblVocabulary: ITable = {
name: this.tableName,
columns: [{
name: "id",
primaryKey: true,
autoIncrement: true
},
{
name: "clas",
dataType: DATA_TYPE.String,
notNull: true
},
{
name: "unit",
dataType: DATA_TYPE.String,
notNull: true
},
{
name: "primaryLanguage",
notNull: true,
dataType: DATA_TYPE.String
},
{
name: "secondaryLanguage",
dataType: DATA_TYPE.String,
notNull: true
},
{
name: "tries",
dataType: DATA_TYPE.Number,
notNull: true,
default: '0'
},
{
name: "failuresCount",
dataType: DATA_TYPE.Number,
notNull: true,
default: '0'
}
]
};
const dataBase: IDataBase = {
name: this.dbName,
tables: [tblVocabulary]
};
My Querry is this (you can see I also tried the ignoreCase option):
getAllVocs(): Promise<any> {
return this.connection.select({ from: this.tableName, order: {by: "primaryLanguage", type: "asc" }, ignoreCase: true});
}
And the result is this:
{"unit":"TestUnit","clas":"TestClass","failuresCount":0,"tries":0,"primaryLanguage":"Germany","secondaryLanguage":"Deutschland","id":7},
{"unit":"TestUnit","clas":"TestClass","failuresCount":0,"tries":0,"primaryLanguage":"Great Britain","secondaryLanguage":"Vereinigtes Königreich","id":6},
{"unit":"TestUnit","clas":"TestClass","failuresCount":0,"tries":0,"primaryLanguage":"after","secondaryLanguage":"nach","id":5},
{"unit":"456","clas":"123","failuresCount":0,"tries":0,"primaryLanguage":"cxvxc","secondaryLanguage":"sdfewf","id":4},
{"unit":"456","clas":"123","failuresCount":0,"tries":0,"primaryLanguage":"dsasd","secondaryLanguage":"wdwad","id":2},
{"unit":"456","clas":"123","failuresCount":0,"tries":0,"primaryLanguage":"rwrf","secondaryLanguage":"xcv","id":3},
{"unit":"TestUnit","clas":"TestClass","failuresCount":0,"tries":0,"primaryLanguage":"to read","secondaryLanguage":"lesen","id":8}]
Here you can see first capital letters and then lower case letters. And I want to ignore the case (lower/upper) of the first letter.
I shall be looking into this.
@RaphiTk - Indexeddb was not able to do incasesensitive sorting . For scenario like yours - I have added an option - idbSorting: Boolean
which acts as flag whether to do idb sorting or not. Default value is true.
Please install the new version - 2.9.0 for this.
So in order to achieve results like you have mentioned , you need to specify idbSorting with value false. I have modified ur query with idbSorting -
connection.select({
from: this.tableName,
order: {
by: "primaryLanguage",
type: "asc",
idbSorting: false
}
});
Thanks for your great work, works perfectly for my case.
However, I noticed 2 things that have changed since version 2.9.0:
It is no more possible to import IDataBase or ITable because:
export * from './interfaces';
is missing in index.d.ts
And idbSorting should be an optional parameter in OrderQuery to enable support for older querries.
Aha i see. I will add those back and Thanks for letting me know.
Hi @RaphiTk - I have added back itable, idatabase and made idbsorting optional . The changes are in new version - 2.9.1.
Please check and let me know.
worked perfect.
Thank you a lot.
Hi,
I started today with using JsStore in my Project and so far I find it really cool and easy to use.
But when I want to do a Select and then Order by a String column, wich sometimes beginns with Upper and sometimes with lowercase, I miss a Upper/Lower function.
e.g. without Upper/Lower function it is sorted like this:
But I want it like this:
Is something like this possible?