MINIUI DataGrid Gets the current row of a column value-MVC

Source: Internet
Author: User

Objective:

This article will introduce to you, MINIUI official website does not involve the content: how to get the value of a column of the current row? Here with Console.log () to use (recently found using Console.log () to debug JS, jquery quite useful), teach you how to find the unknown properties.

Program Requirements:

You need to know the value of a column of the currently selected row, and then selectively display the content.

We look at the API of the official website, looking very good, but do not apply.

Change ideas:

A crossing network API are not, just want to directly debug it, with DataGridView control use of sentiment, intends to find table, and then index out row, column, probably this looks like: Table.rows[i].cells[j].value nn ...

Actual operation:

1>. First, load a DataGrid with two rows of data and have the following JS code:

mini.parse (); var grid = Mini.get ("DataGrid1"); Grid.load ();

function Click () {
Console.log (GRID);
}

After compiling the run, open our powerful F12, find the console, analogy to the →google console.

After performing the operation, we will see the following:

This is what the grid shows, how can I find a specific column in a particular row in it? When I dragged down the right, I found columns, which made me overjoyed, but I began to look at the data and found it, not what I was looking for.

Immediately after, I saw the data, unfold a look, originally all hid this!

So I went back to the original object and found the data:

Now that you have found the data, you have to show it, so add a sentence in the script:

mini.parse (); var grid = Mini.get ("DataGrid1"); Grid.load (); function Click () {   console.log (grid);
Console.log (grid.data);}

Compile, execute, look at the effect:

We see here is an array of arrays, see the right side of the display, we know that 0 represents the first row of data, 1 for the second row of data, so we first display the first row of data:

mini.parse (); var grid = Mini.get ("DataGrid1"); Grid.load (); function Click () {   console.log (grid);   Console.log (grid.data);   Console.log (grid.data[0]);}

Compile, execute, look at the effect:

The first row of data are all displayed, you can see all the key, value, this time the heart of a bit of the bottom, finally see hope, but also to maintain calm, to now we urgently hope to a point, you can index all the attributes, but unfortunately this is not C #, no related classes, Then just try to complete the code after the JS, manually added a ["Xmxh"]:

mini.parse (); var grid = Mini.get ("DataGrid1"); Grid.load (); function Click () {   console.log (grid);   Console.log (grid.data);   Console.log (grid.data[0]);   Console.log (grid.data[0]["Xmxh"]);}

Compile, run, see effects:

We see that the corresponding data is displayed. We then combine the MINIUI official website API, given to get the row index number, get the currently selected row of the two methods, you can get any current row of the DataGrid the value of a column.

The specific implementation code is as follows:

mini.parse (); var grid = Mini.get ("DataGrid1"); Grid.load (); function Click () {     var currentrow = grid.getselected ();      var row = grid.indexof (currentrow);     Alert (grid.data[row]["Xmxh");}

PostScript: About the use of MINIUI, the current use of the most is the DataGrid, the official website of the API is very concise (and simple relative), but the actual development or need to spend their time to ponder the study, the above content for my test, if inappropriate, please leave a message to discuss!

MINIUI DataGrid Gets the current row of a column value-MVC

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.