jQWidgets Forums

Forum Replies Created

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts

  • branko7171
    Member

    Thanks a lot. It works like I intended it to.


    branko7171
    Member

    Sorry about not letting you know (forgot about this post, since I’ve made a bunch), but I’ve figured it out. It works fine now, thank you.

    in reply to: Append jqxGrid to jqxPanel? Append jqxGrid to jqxPanel? #10455

    branko7171
    Member

    Didn’t know that clearcontent removes the entire DIV. It works as it should now.
    Thank you so much! You’ve been a great help.

    in reply to: Append jqxGrid to jqxPanel? Append jqxGrid to jqxPanel? #10410

    branko7171
    Member

    Tried it. In the php I echo “set” if selItemObl is set. The first time I select that variable is passed and the response I get is “set”. However,
    the second time it doesn’t work. I checked with firebug and it seems there is no GET request like the first time. So, no request and because of that no response.

    in reply to: Append jqxGrid to jqxPanel? Append jqxGrid to jqxPanel? #10403

    branko7171
    Member

    I see. Changed that code to this:

    processdata: function (data) {
    data.selItemObl = item3;
    if (data.selItemObl) data.selItemObl = data.selItemObl.id;
    else data.selItemObl.id = 0;
    }

    The if…else statement ensures that I will send id. But it still doesn’t work. Also, I have tried with just data.selItemObl = item3.id;

    in reply to: Append jqxGrid to jqxPanel? Append jqxGrid to jqxPanel? #10303

    branko7171
    Member

    I have another problem. Hope it’s ok to post here again…
    I have several elements (2 trees and 2 listboxes). On select event of those elements I need to append a different grid, which in turn loads different data from a mysql database. The grids append and show data correctly, but only once.
    Here’s how I do it (one of 2 trees, it’s similiar for the rest):

    $('#problemiTree').bind('select', function (event) {
    dataAdapter4.dataBind();
    var item3 = $('#problemiTree').jqxTree('getSelectedItem');
    var sourceGridOblast ={
    datatype: "json",
    async:false,
    datafields:
    [{ name: 'Naziv' },
    { name: 'NadOblast' },
    { name: 'Opis' }],
    url: 'gridData.php',
    processdata: function (data) {
    data.selItemObl = item3;
    if (data.selItemObl) data.selItemObl = data.selItemObl.id;
    else data.selItemObl = 0;
    }
    };
    var dataAdapterSourceGridOblast = new $.jqx.dataAdapter(sourceGridOblast);
    var jqxgridOblastOptions ={
    source: dataAdapterSourceGridOblast,
    theme: 'classic',
    columns:
    [{ text: 'Naziv',datafield: 'Naziv', width: 150 },
    { text: 'Nadoblast', datafield: 'NadOblast', width: 150 },
    { text: 'Opis', datafield: 'Opis', width: 400 }]
    };
    $('#svojstvaPanel').jqxPanel('clearcontent');
    $('#svojstvaPanel').jqxPanel('append', $("#grid3")[0]);
    $("#grid3").jqxGrid(jqxgridOblastOptions);
    });

    The problem is that no variable is passed using processData. I’ve tried using dataAdapterSourceGridOblast.dataBind() in that event (defined the source and created the adapter on document ready but it didn’t solve my problem).
    Thanks.

    in reply to: Append jqxGrid to jqxPanel? Append jqxGrid to jqxPanel? #10125

    branko7171
    Member

    Thanks again. It works. The problem was in my php code…

    in reply to: Append jqxGrid to jqxPanel? Append jqxGrid to jqxPanel? #10071

    branko7171
    Member

    Ok, it seems I have to do it with options like you said.
    My code is now:

    var sourceGridTest ={
    datatype: "json",
    datafields:
    [{ name: 'Naziv' },
    { name: 'Trajanje' },
    { name: 'Predmet' },
    { name: 'SablonId' },
    { name: 'KriterijumTesta' },
    { name: 'DatumPripreme'},
    { name: 'DatumIzrade'},
    { name: 'Stanje'}],
    url: 'gridData.php'
    };
    var dataAdapterSourceGridTest = new $.jqx.dataAdapter(sourceGridTest, {
    downloadComplete: function (data, status, xhr) { },
    loadComplete: function (data) { },
    loadError: function (xhr, status, error) { }
    });
    var sourceGridProblem ={
    datatype: "json",
    datafields:
    [{ name: 'Naziv' },
    { name: 'Opis' },
    { name: 'Oblast' },
    { name: 'VrstaProblema' },
    { name: 'Odgovor' },
    { name: 'Tezina'},
    { name: 'Autor'},
    { name: 'Komentar'},
    { name: 'DatumPripreme'},
    { name: 'StanjeUTestu'},
    { name: 'Tacno'},
    { name: 'Netacno'},
    { name: 'Izostavljen'},
    { name: 'Vise'}],
    url: 'gridData.php'
    };
    var dataAdapterSourceGridProblem = new $.jqx.dataAdapter(sourceGridProblem, {
    downloadComplete: function (data, status, xhr) { },
    loadComplete: function (data) { },
    loadError: function (xhr, status, error) { }
    });
    var jqxgridProblemOptions ={
    source: sourceGridProblem,
    theme: 'classic',
    columns:
    [{ text: 'Naziv',datafield: 'Naziv', width: 150 },
    { text: 'Trajanje', datafield: 'Trajanje', width: 75 },
    { text: 'Predmet', datafield: 'Predmet', width: 120 },
    { text: 'Sablon', datafield: 'SablonId', width: 70 },
    { text: 'Kriterijum Testa', datafield: 'KriterijumTesta', width: 120 },
    { text: 'Datum Pripreme', datafield: 'DatumPripreme', width: 120 },
    { text: 'Datum Izrade', datafield: 'DatumIzrade', width: 130 },
    { text: 'Stanje', datafield: 'Stanje', width: 120 }]
    }
    var jqxgridTestOptions ={
    source: sourceGridTest,
    theme: 'classic',
    columns:
    [{ text: 'Naziv',datafield: 'Naziv', width: 150 },
    { text: 'Trajanje', datafield: 'Trajanje', width: 75 },
    { text: 'Predmet', datafield: 'Predmet', width: 120 },
    { text: 'Sablon', datafield: 'SablonId', width: 70 },
    { text: 'Kriterijum Testa', datafield: 'KriterijumTesta', width: 120 },
    { text: 'Datum Pripreme', datafield: 'DatumPripreme', width: 120 },
    { text: 'Datum Izrade', datafield: 'DatumIzrade', width: 130 },
    { text: 'Stanje', datafield: 'Stanje', width: 120 }]
    };

    For testing:

                    if (3<0)
    {
    $('#svojstvaPanel').jqxPanel('clearcontent');
    $('#svojstvaPanel').jqxPanel('append', $("#jqxgridTest")[0]);
    $("#grid1").jqxGrid(jqxgridTestOptions);
    }
    else
    {
    $('#svojstvaPanel').jqxPanel('clearcontent');
    $('#svojstvaPanel').jqxPanel('append', $("#jqxgridProblem")[0]);
    $("#grid2").jqxGrid(jqxgridProblemOptions);
    }

    I’ve used a condition to enter ‘else’ branch but grid2 doesn’t show. Grid1 shows fine.

    Here’s the panel and grids:

    <div class="splitter-panel">
    Svojstva
    <div id="svojstvaPanel">
    &nbsp;
    </div>
    </div>
    <div id="grid1">
    </div>
    <div id="grid2">
    </div>
    in reply to: Append jqxGrid to jqxPanel? Append jqxGrid to jqxPanel? #10070

    branko7171
    Member

    Hm, so it doesn’t work if I initialize before if…else like this:

    $("#jqxgridTest").jqxGrid({
    source: sourceGridTest,
    theme: 'classic',
    columns:
    [{ text: 'Naziv',datafield: 'Naziv', width: 150 },
    { text: 'Trajanje', datafield: 'Trajanje', width: 75 },
    { text: 'Predmet', datafield: 'Predmet', width: 120 },
    { text: 'Sablon', datafield: 'SablonId', width: 70 },
    { text: 'Kriterijum Testa', datafield: 'KriterijumTesta', width: 120 },
    { text: 'Datum Pripreme', datafield: 'DatumPripreme', width: 120 },
    { text: 'Datum Izrade', datafield: 'DatumIzrade', width: 130 },
    { text: 'Stanje', datafield: 'Stanje', width: 120 }]
    });
    $("#jqxgridProblem").jqxGrid({
    source: sourceGridProblem,
    theme: 'classic',
    columns:
    [{ text: 'Naziv',datafield: 'Naziv', width: 150 },
    { text: 'Trajanje', datafield: 'Trajanje', width: 75 },
    { text: 'Predmet', datafield: 'Predmet', width: 120 },
    { text: 'Sablon', datafield: 'SablonId', width: 70 },
    { text: 'Kriterijum Testa', datafield: 'KriterijumTesta', width: 120 },
    { text: 'Datum Pripreme', datafield: 'DatumPripreme', width: 120 },
    { text: 'Datum Izrade', datafield: 'DatumIzrade', width: 130 },
    { text: 'Stanje', datafield: 'Stanje', width: 120 }]
    });

    I do it like that because I have 2 different sources. The reason for that is that I have to get different data from a mysql database based on what the user selects.


    branko7171
    Member

    I’ll try that. Thanks.
    Edit: I’m already echoing JSON and checking by a direct link to the php file. Everything seems to be in order because JSON data is there.
    That confirms that data really is getting to the client, right?

    in reply to: Append jqxGrid to jqxPanel? Append jqxGrid to jqxPanel? #9976

    branko7171
    Member

    Thanks, but I still have a problem.
    I’ve added:

    <div id="jqxgridTest">
    </div>
    <div id="jqxgridProblem">
    </div>

    Similiar to yours, but when I have that piece of code both grids are shown. When I comment it I get neither of the grids.
    This is how I append:

                    if (true)
    {
    $('#svojstvaPanel').jqxPanel('clearcontent');
    $('#svojstvaPanel').jqxPanel('append', $("#jqxgridTest")[0]);
    }
    else
    {
    $('#svojstvaPanel').jqxPanel('clearcontent');
    $('#svojstvaPanel').jqxPanel('append', $("#jqxgridProblem")[0]);
    }

    branko7171
    Member

    Thank you for the quick reply.

Viewing 12 posts - 1 through 12 (of 12 total)