2

I want to use the following start with operand in jqGrid:

select * from lib where (mesc.substring(0,2) between 13 and 60)

In jqGrid I have just a start with but do not have a start with between, and I would like to add this operand to the search operand.

I have a lib table, and in the lib table I have a mesc field (datatype mesc is nvarchar(10)). In this table I save material information. I group records in the case when Mesc starts with 13 to 60, 6 to 70, and 80 to 90. Possibly the end user would want to see all materials that start with 13 to 16, or 13 to 60. I do not know how to implement this.

DisplayName
  • 3,093
  • 5
  • 35
  • 42
mohsen
  • 23
  • 3
  • Sorry, but it's absolutely unclear what you mean. If you have database on the server you can generate *any* SQL statement based on parameter which jqGris send. What scenario you use? From where come the constants like 13 and 60? I can continue with unclear questions... – Oleg Dec 19 '12 at 10:06
  • @Oleg : i Edit Qustion. please help me. thanks. – mohsen Dec 19 '12 at 10:38

1 Answers1

1

You can use two external <input> elements where the user can enter the value for mesc field and <button> "Search". You can send the values from the filed to the server with every refresh of the grid or by click on the "Search". See the answer for details.

You can alternatively use only one <input> element and allow the user to enter input in the form 13 - 60. In general you can implement any input options which you need like Sliders, Spinner and so on.

You can integrate the external input elements in the top toolbar of jqGrid if you what. See the answer for details.

In any way you can generate any SQL statement based on users input on the server side.

Community
  • 1
  • 1
Oleg
  • 220,925
  • 34
  • 403
  • 798
  • if want use first solution.you can when user select mesc display tow input? – mohsen Dec 19 '12 at 11:32
  • @mohsen: Sorry, I don't understand what you mean. – Oleg Dec 19 '12 at 11:34
  • i want use first solution, i want when user click in search icon and disply search box and user select Mesc field display two textbox and user enter data in text box . – mohsen Dec 19 '12 at 11:43
  • @mohsen: Sorry, but I don't understand your question. stackoverflow is not place where other will develop solution for you for free. It's the place where developers could formulate *question which could be interesting for other*. If another developer could give a tip how to solve some technical problem from the question he write the answer. I don't understand from your previous comment what is your problem and what knowledge in HTML, JavaScript, jQuery, SQL etc you have. Sorry. – Oleg Dec 19 '12 at 11:51