Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jan 31 2019 15:58
    truckingsim commented #152
  • Jan 31 2019 15:16
    RomanRabirokh commented #152
  • Jan 31 2019 15:05
    jcrawford commented #152
  • Jan 31 2019 15:05
    jcrawford reopened #152
  • Jan 31 2019 15:05
    jcrawford commented #152
  • Jan 31 2019 14:48
    RomanRabirokh commented #152
  • Jan 31 2019 14:42
    jcrawford commented #152
  • Jan 31 2019 14:42
    jcrawford closed #152
  • Jan 31 2019 14:42
    jcrawford commented #152
  • Jan 31 2019 14:40
    RomanRabirokh commented #152
  • Jan 26 2019 07:36
    masteriii commented #163
  • Jan 24 2019 17:43
    truckingsim commented #163
  • Jan 24 2019 11:43
    masteriii edited #163
  • Jan 24 2019 11:40
    masteriii opened #163
  • Jan 20 2019 18:47
    Itay4 opened #162
  • Nov 28 2018 09:33
    agil-NUBBA closed #150
  • Nov 28 2018 09:33
    agil-NUBBA commented #150
  • Nov 28 2018 09:08
    reloxx13 commented #83
  • Nov 28 2018 08:46
    reloxx13 commented #83
  • Nov 28 2018 08:24
    reloxx13 commented #150
Al Grant
@bigalnz
yeah totally....
i just thought of it as I was typing to you
Adam Heim
@truckingsim
I prefer to have auto incrementing id's not tied to display data, but that's just me
I also come from a strict relational DB background.
not this willy nilly nosql stuff that's out there now.
Al Grant
@bigalnz
But what happens if you go to load a new copy of the code table and the Id's change - then it would screw up existing data?
Adam Heim
@truckingsim
I mean again that's an issue for the tooling, you would normally use a DB dump, or you would have schema data, which builds upon responses of things returned.
So it wouldn't matter the ID because it will just the one returned from the insert
schema data === scaffolding... like you wouldn't build everything at once, you build on top of the previous thing, which means you have id's returned from the inserts to work with.
or you use an ORM which handles all this for you
so yeah, that's a tooling problem
Al Grant
@bigalnz
So you would never change a given code's ID - if you need to update the table you only add to it, not empty and reload?
Adam Heim
@truckingsim
again just me, but for me id would be a auto incrementing primary key column. Code would be a unique integer or text (if codes are ever not numbers).
this way you can't insert a code more once
Al Grant
@bigalnz
right so the question is then a valid one for bootstrap-select. I need to return in the dropdown the "Charge Text" ie "Murder" and the ID "id" "4" which is the DB identifier
Adam Heim
@truckingsim
if you have other tables that rely on Code as in foreign Keys, you have 2 options, either make the foreign keys fail on delete or cascade on delete
Just change your value to item.Id
Al Grant
@bigalnz

So I just change:

        preprocessData: function (data) {
            var offences = [];
            data.forEach(function (item) {
                offences.push({
                    value: item.code,
                    text: item.chargeText
                });

to item.idCode

Adam Heim
@truckingsim
what?
value: item.code, becomes value: item.Id,
Al Grant
@bigalnz
instead of returning item.code (1110) I return item.IdCode - yeah its the weird naming convention
idCode is the DB id
Adam Heim
@truckingsim
I was just using what you put above, yes just use whatever db column you need for the value
Al Grant
@bigalnz
ta
I cant see in the browser dev tools where you can inspect the value the dropdown is passing?
Adam Heim
@truckingsim
that's because of how bootstrap-select works, it completely replaces the select, you need go up a level or two to get to it.
it hides it with a display:none
Al Grant
@bigalnz
I am just printing the array to console :-)
Adam Heim
@truckingsim
sure that works too
Al Grant
@bigalnz

The id is coming back

"[{"code":"1110","chargeText":"1110 - Murder","id":3},

So now each row in the array has Code, chargeText, id
so it should be item.id
that seems to be working -nice
I really love your dropdown select
:+1:
Adam Heim
@truckingsim
Thanks
Adam Heim
@truckingsim
v1.4.0 has been released. cdnjs should pick up on it sooner than later.
Al Grant
@bigalnz
You about Adam?
Al Grant
@bigalnz
You there Adam?
Al Grant
@bigalnz
Have you ever used your dropdown with thymeleaf?
Al Grant
@bigalnz
when the form loads I need it to display a already selected value if one is returned from the database. Having a issue with that
Adam Heim
@truckingsim
@bigalnz no I've never used it with that, I've only ever actually used the plugin with one site, the one I created it for, and it died like 6 months after creating the plugin.
I've just kept updating the plugin b/c other people find it useful, but I'll probably never use it again personally.
Al Grant
@bigalnz
It's OK I got it to go
👍👍
Al Grant
@bigalnz
Hey Adam - are you aware of bootstrap select pickers being really slow to render? not your pickers - but the standard plugin
Al Grant
@bigalnz
Hi Adam. Does cloning work with your ajax select?
ribubrar
@ribubrar
Hi Adam, hope you are doing good.
I was facing some problem running live ajax search and I have commented on a thread
truckingsim/Ajax-Bootstrap-Select#83
Could you please take a look at it. Many thanks!
ribubrar
@ribubrar
@truckingsim Could you please help me debug the code in thread with last comment?
truckingsim/Ajax-Bootstrap-Select#31