---
title: "Ext获取grid选中列的值"
author: "陈碧滔"
date: "2011-05-19T23:11:00Z"
tags: []
categories: ["Web前端"]
slug: "ext-grid"
draft: false
lastmod: "2011-06-28T21:41:45Z"
id: 1108477
url: "https://cbt.iteye.com/blog/1108477"
---

var sm = new Ext.grid.CheckboxSelectionModel({singleSelect:true}); //选择列

singleSelect:true 只能选择单行

将sm加载进grid

var listGrid = new Ext.grid.GridPanel({

ds: ds,

cm: cm,

sm: sm})

取出选中行的对象

var clickone =listGrid.getSelectionModel().getSelected();//获取一行

clickone.get(“Unitno”);取出数据

recordlist =listGrid.getSelectionModel().getSelections();//获取多行

recordlist\[i].get(“Unitno”);取出数据

获取选中对象中的值

Var xxx = clickone.get('Unitno') Unitno为grid中对应的name值