question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to change items in select after load page ?

See original GitHub issue
  $("#jsGrid").jsGrid({
        controller: {
        loadData: function(filter) {
            var d = $.Deferred();
            $.ajax({
                url: "url",
                dataType: "json",
                data : filter,
             }).done(function(response) {
            d.resolve(response);
        });
        return d.promise();
        },
    },
        fields: [
            { name: "project", items: [{"id" : 0, "name" : "test"}], valueField: "id", textField: "name", type: "select"  }
        ]
    });

json source:

{ "data" : [{"project" : test }], "project_items" : [{"id" : 1, "name" : "test" }] }

I want to change items in “project” fields after load table. Is it possibile ?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
tabalinascommented, Jul 23, 2016

Have you tried to change it with fieldOption (http://js-grid.com/docs/#fieldoptionfieldnamefieldindex-optionname-optionvalue):

$("#grid").jsGrid("fieldOption", "projects", newItems)
0reactions
tabalinascommented, Sep 10, 2017

@Seolhun, not sure the issue clear. Please open a separate issue and provide more details (with code snippets) or even better a jsfiddle showing the problem.

Read more comments on GitHub >

github_iconTop Results From Across the Web

jquery - change select option after 2 seconds of page load
change select option after 2 seconds of page load · 1. You can do like this : $('select[name="select1"]'). · Thank you for the...
Read more >
How to change selected value of a drop-down list using jQuery?
With jQuery, it is easy to writing one line of code to change the selected value from a drop-down list. Suppose, you have...
Read more >
Add, select, or clear items | Select2 - The jQuery replacement ...
Programmatically adding, selecting, and clearing options in a Select2 control. ... Select the option with a value of '1' $('#mySelect2').trigger('change'); ...
Read more >
Dropdown Navigation: How to Maintain the Selected Option ...
Iterate through all options, grab their data-url attribute value, and check to see whether this value is part of the page url or...
Read more >
Set Focus on <select> Element on Page Load - EncodeDna.com
This post has two examples showing how to set focus and automatically expand select dropdown option on page load using HTML5 attribute and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found