Multicombo - serverside not load?

Hi, I'm trying to use serverside options for my multicombo module or even combo module. I tried options alone and it show unidentified for all options. In this snippet https://snippet.webix.com/tlmt5h2j can you tell me what's the differences between "viewsArray" and "names"?, they both seem same to me but the result are not the same. My viewsArray is not showing anything.

Tagged:

Comments

  • in my remark.php give back json contains column id, remark, desc but I will have to use it to filter later so I set both id and value on viewsArray as remark.

  • edited September 9

    in fact viewsArray is generated after some delay (loaded from server) and is empty when defined as data source.
    instead try to set viewsArray as promise object
    https://snippet.webix.com/l0fpn9ou

  • On the similar case (or not), im using both dataview and datatable but hiding dataview at start using button to switch between datatable and dataview. Can I use data in datatable in dataview? For example, start with datatable and filter something out and I want to switch to dataview with those filter still applied.
    I used text with global filter.

  • edited September 9

    if both views use the same data then try to sync them with DataCollection and apply this hack
    https://snippet.webix.com/9txgsln6
    or this
    https://snippet.webix.com/b5neurnn

    1. on viewsArray, I changed it as you said and now encounter another problem. My viewsArray are all shown as "undefined".

    2. For the same data part, I have something like this https://snippet.webix.com/ztwb88di all the other functions are working only the data to load. As DataCollection is just using the same source of data, I want to use the form to filter the datatable and also change the dataview. Are there any better solution for this? my idea now is just to do something like serialize data from datatable and let dataview load it but not yet work might be as the first problem that data is load after page.

    Thanks

  • I added some functions so it's more clearof what I'm trying to explain, https://snippet.webix.com/8n7irfst

  • edited September 10

    @savirusing
    use shared DataCollection as data source and apply filter to this collection instead of table.
    you can use same filter logic (using table's columns as filter fields).

  • Thanks, now I can filter data and show same result on both dataview and datatable. Next question is, can I use same pager that link to both of them? now my pager will only effect on dataview only.

    and any clues on viewsarray is showing undefined?

  • viewsarray - seem like return result is not sending back with id and value but still the same as database(such as remark), I tried adding new column name value in database and now it's showing but this is not what Im trying to do

  • 01| var viewsArray = webix.ajax().post("../srv/remark.php", function(text){
    02| remark = JSON.parse(text);
    03| var result = [];
    04| for(var i = 0; i < remark.length; i++){
    05| result.push({
    06| id: remark[i].id,
    07| value:remark[i].remark,
    08| });
    09| }
    10| return result;
    11| });

    I did some change to see where does the options stop loading and found that my combo only load data on 01 row of command and show undefined for all, push and return is not effect anything. viewsArray still showing original data

  • @savirusing
    you are using callback instead of promise's return.
    callback does not modify promise's data.
    try this

    var viewsArray = webix.ajax().post("../srv/remark.php").then((data)=>{
        remark = data.json();
        var result = [];
        for(var i = 0; i < remark.length; i++){
            result.push({
                id: remark[i].id,
                value:remark[i].remark,
            });
        }
        return result;
    });
    
  • @intregal Thanks for helping me out, the last one also shown undefined. So I decide to change my php and just assign id and value there and now working fine.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!